[PyQt] An "UI update" event/signal to update the GUI on

David Boddie david at boddie.org.uk
Sun Jan 18 16:18:55 GMT 2009


On Sun Jan 18 13:41:00 GMT 2009, eliben wrote:

> I'm porting some code from wxPython to PyQt, and am unable to find the
> replacement for wx's wx.EVT_UI_UPDATE event. This event is sent to a
> frame/window whenever the UI has to be updated. In the handler of the event
> I can check my application's state and update the widgets accordingly (for
> instance, disable some buttons, enable others, etc). This save code versus
> the approach of having a separate update handler for each widget.

You don't typically need to do this for normal user interfaces with PyQt.
If you set up signals and slots connections between widgets, they will be
updated automatically.

To update complete windows to take account of changes elsewhere in an
application, you would typically connect a signal from the object causing
the change to a custom slot in the window. Some of the PyQt examples use
this kind of technique to update menu items or actions.

Widgets do have an update() method, but it's typically used with custom
widgets that draw their own content.

> Please recommend an equivalent way to achieve this in PyQt.

Can you give more information about your user interface? It would make it
easier to recommend the best approach for you to take.

David


More information about the PyQt mailing list