2

We are creating a program that uses two different libraries sequentially: Tkinter and WxPython. Once the script for Tkinter is initialized, the backend library Tcl/Tk prevents the execution of any Wx functions. We want to be able to remove all traces of memory of Tcl/Tk before we launch our script that uses Wx.

We have tried deleting all associated Tkinter references using the sys module, but we have had no success. We have also tried using the multiprocessing module to isolate the frameworks to separate processes, but this was unachievable as a GUI cannot be initialized through a sub-process.

Our goal is to package this into a single standalone application.

nbro
  • 15,395
  • 32
  • 113
  • 196
user2631970
  • 67
  • 1
  • 8
  • "the backend library Tcl/Tk prevents the execution of any Wx functions". How does it prevent it? Does it throw an error? The statement seems to make no sense. If there is no tkinter mainloop running, I don't see how it's possible for it to interfere with anything else. – Bryan Oakley Jun 26 '15 at 19:13
  • See this link: http://stackoverflow.com/questions/31016252/running-wxpython-after-closing-tkinter – user2631970 Jun 26 '15 at 19:39
  • So, you're saying that if your program *only* calls wxPython it works, but if you add in a tkinter GUI and destroy it, you're no longer able to call wxPython code? I guess that's not too surprising -- these two were never designed to work together. – Bryan Oakley Jun 26 '15 at 20:11
  • You've got it. We were thinking that there must be some way to give the program amnesia---make it forget that it ever touched Tk in the first place by deleting everything. Nothing has worked so far; once you call Tkinter.Tk() there is no way to switch over to Wx. – user2631970 Jun 26 '15 at 20:17
  • @user2631970 Have you tried with `root.quit()` instead of `root.destroy()`? Theoretically, the first should also stop the Tcl interpreter associated with the `Tk` instance... – nbro Jun 26 '15 at 21:33
  • We have tried both root.quit() and root.destroy(), without successful results. – user2631970 Jun 26 '15 at 22:08
  • The safest and probably the most reliable thing to do would be to launch the wxPython app as a new process (not via multiprocessing.) Or to rewrite the tkinter app as a wxPython application. – RobinDunn Jun 27 '15 at 23:22
  • [Python does not support unimporting modules.][1] [1]: http://stackoverflow.com/questions/3105801/unload-a-module-in-python – I_do_python Jun 29 '15 at 10:47
  • You could try using threads like in this topic? http://stackoverflow.com/questions/31016252/running-wxpython-after-closing-tkinter – Dan Alexander Jul 31 '15 at 05:19

0 Answers0