Python getUiEvent [message #1855038] |
Sun, 25 September 2022 06:37  |
Eclipse User |
|
|
|
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 08:03  |
Eclipse User |
|
|
|
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.
|
|
|
Powered by
FUDForum. Page generated in 0.02860 seconds