COM object with events and GUI update
Wolfgang Thaemelt
wolfgang.thaemelt at orsoft.de
Tue Jul 25 23:14:18 EDT 2000
I am using a COM object that fires events. Data I received in the event handler
should be used to update a Tcl/Tk GUI.
To do this I use the following code structure:
events = [list_with_event_information]
class ORSSystemEvents: # event handler
def OnChanged(self, ChangeType):
global events
events.append("ORSSystem OnChanged event " + str(len(events)))
...
return
def update(): # update main window - show event info
global events, ...
# prepare data for GUI from events list
...
root.update_idletasks()
root.after(500, update)
return
ident = win32com.client.DispatchWithEvents("ORS.Ident",ORSIdentEvents)
# build GUI
root.after(500, update)
root.mainloop()
This code works but seems to be a bit dangerous.
Is there a way to update the GUI directly from the OnChanged event handler? All
my attempts to do this failed.
Can I avoid the use of the after(...) method?
Is there some extended documentation about event firing and handling available?
Thanks for help.
Wolfgang Thaemelt
OR Soft Jaenicke GmbH
Geusaer Str., FH Geb. 106
06217 Merseburg
Germany
======================================
Email: wolfgang.thaemelt at orsoft.de
Voice: +49-3461-549033
Fax: +49-3461-549022
More information about the Python-list
mailing list