wxPython Or Tkinter (or both? w/ threads?)
Chad Franklin Netzer
cnetzer at Stanford.EDU
Thu Aug 16 23:45:48 CEST 2001
I have an app that uses Tkinter. It plots data and
allows for interactive modification of that data.
However, the Tkinter Canvas is so slow that I've also
had to support PyOpenGL rendering (which is a pain
because Togl has "issues").
One thought I've had is to switch completely to another
GUI toolkit, such as wxPython, or PyGtk. However, I
thought it might be possible to just support the
Canvases (or direct drawing) of another GUI, while
still using Tkinter for the remainder of the interface.
So, can anyone tell me how this might be accomplished.
I made a test program to demonstrate that I could run
both the Tkinter and wxPython mainloops in separate
threads. What are the limits of this approach (I
assume their will be issues with event handling)? Is
it really just this simple?
Tk = Tkinter
from wxPython.wx import *
print "Tkinter button pressed"
print "wxPython button pressed"
frame = wxFrame(NULL, -1, "Hello from wxPython")
wx_button = wxButton(frame, 10, "Hello", wxPoint(20, 20))
EVT_BUTTON(frame, 10, wx_button_press)
if __name__ == '__main__':
tk_root = Tk.Button(text='Tkinter', command=tk_button_press)
wx_root = MyWxApp(0)
t = threading.Thread( target=wx_root.MainLoop )
chad.netzer at stanfordalumni.org
More information about the Python-list