Replies: 1 comment 2 replies
-
Some additional notes from "Modern PyQt" by APRESS, page 25. Event Handling with Signals and Slots GUIs are designed to be responsive. When a user clicks a button, types on the keyboard, or when a timer times out, these actions signal events and must be handled by the application. These events can often lead the program to modify its behavior. Event handling in PyQt is performed with the signals and slots mechanism and with special event handlers. Signals are the events that are triggered when a button is clicked or a tab is switched. Slots are the methods that perform defined actions in response to the signal. Slots can be built-in PyQt functions or Python methods created specifically for the application. The connect() method associates the emitted signal with its intended slot. |
Beta Was this translation helpful? Give feedback.
-
In Microsoft's WPF and C#, XAML elements that describe a GUI can be bound to properties (either one-way or two-way binding).
Binding means that if a GUI element changes, the C# "code behind" "property" that stores the GUI element value is magically updated.
With two-way binding, things also work in the other direction, thus updating the property will update the GUI element.
I'm not sure how Toga handles binding, if at all. Callbacks are used to do things that originate with the user, such as service the pressing of a button. Thus a button press could be said to be mapped onto a function or method.
For other cases, where the user may not be involved, such as data that is incoming from the web and needs to be displayed on the GUI, how would I update a text label that is buried in the GUI tree? Should I scan thru the tree looking for the "id"?
I'm not seeing an obvious and/or elegant solution, and I'm sure I am missing something vital here :-) Any thoughts or advice? Thanks.
Beta Was this translation helpful? Give feedback.
All reactions