Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Proposals » Eclipse Advanced Scripting Environment (EASE) » Python getUiEvent(How do I get the result of a checkbox selection using Python?)
Python getUiEvent [message #1855038] Sun, 25 September 2022 10:37 Go to next message
Shane Lontis is currently offline Shane LontisFriend
Messages: 1
Registered: September 2022
Junior Member
I am trying to create a custom Dialogbox in python.

I would like to use getUiEvent when the onSelect() event is triggered listed..
I assume this would require it to know that it was a Button in order to use the getSelection() method.
The below code is hacking it in using globals... What is the correct way to do this?

loadModule('/System/UI')
loadModule('/System/UI Builder')
loadModule('/System/Scripting')

#Nasty global hack..
cb = None
cb_selected = False

def cdialog():
    createDialog("create()", "Title", None).open()
    print("Got here")
    
def onSelect():
    globals()['cb_selected'] = globals()['cb'].getSelection()
    
def create():    
    createLabel("Function:", "1/1");
    createText("2-6/1");
    globals()['cb'] = createCheckBox("cb", cb_selected, "onSelect()", "1/2")

result = executeUI("cdialog()")
Re: Python getUiEvent [message #1860710 is a reply to message #1855038] Mon, 28 August 2023 12:03 Go to previous message
Hassan Izhar is currently offline Hassan IzharFriend
Messages: 6
Registered: January 2023
Junior Member
Hello Shane Lontis,

Creating a custom dialog box in Python can be a powerful way to enhance the user experience of your application. It sounds like you're working on implementing the onSelect() event for a button within your custom dialog. To achieve this in a more organized and structured manner, you can utilize object-oriented programming principles.

Here's a general outline of how you can approach this:

Create a Custom Dialog Class:
Define a class for your custom dialog box. This class should inherit from a suitable base class provided by your GUI framework (e.g., QDialog in PyQt or Dialog in Tkinter).

Initialize the Dialog:
In the constructor of your custom dialog class, you can set up the UI components including the button that you want to trigger the onSelect() event.

Connect the Button Signal:
Use the appropriate method to connect the button's signal (e.g., clicked signal in PyQt) to a slot or function that will handle the onSelect() event.
Previous Topic:EASE installed but Jython not available as Engine
Goto Forum:
  


Current Time: Wed Dec 11 23:39:50 GMT 2024

Powered by FUDForum. Page generated in 0.03475 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top