Page 1 of 1

Why Tkinter is not allowed in Modul8 ?

Posted: Mon Mar 02, 2009 10:14 am
by Anome
Hi,

Despite you can import Tkinter or tkFileDialog in a Modul8 module, you cannot use it (it throws an exception when instancing it). Why ?
I would like to save a module's preset in a file with tkFileDialog.asksaveasfile() ...

Thanx :)

Posted: Sun Sep 13, 2009 11:48 am
by Anome
up.

I d like to use Tkinter with Modul8 but it s not working.

These 2 lines are working in python but not in modul8 :

Code: Select all

from Tkinter import *
root = Tk()  #throw an exception


why ? It could be great to use Tkinter with Modul8 to improve the ergonomy of the modules !!! (no, really ... for advanced module it is such a pain to have something intuitive)

Posted: Sun Sep 13, 2009 4:57 pm
by ilan
I'll check with our team why.

Posted: Mon Sep 14, 2009 2:23 pm
by david
Hello Anome,

Tkinter is throwing an execption because it is trying to access sys.argv[0], which we do not define in our embedded Python context.

For example, you could prevent this sys.argv[0] access by :

Code: Select all

from Tkinter import *
root = Tk("foo", "bar")


But the problem with Python's UI extensions (Tk, EasyDialog, ..) is that our Python engine is not run from the main thread (the one which holds the UI event loop).
So even, when the import seems to work, it does not dispatch UI event to the mainloop, so your UI extension will not work.

There is currently no way to make Python UI works in Modul8.

Posted: Mon Sep 14, 2009 3:24 pm
by Anome
Hi,

Ok, Tkinter wont work (I try with 'root.update()' but it s locking the rest of Modul8's interface).
Lets continue this technical conversation : it s very important for the modules ergonomy !

I ve already wrote a class which is a TabNavigator : it was very simple because I only needed a 'View' component ; the tabs are 'Groups' that are shown or hidden.

But for FileDialog popups (to save a preset for example), I need at least a 'List' and a 'TextField' component ... How to instanciate these from scratch ?

OR, if I put in my module many 'List' and 'TextField' that I can reuse, how to change the depth of these components ?



Thanks for giving me an hint, and I repeat : it could be very useful for Modul8. Especially because I ve implemented a system which can download and use external python classes, so no need to rewrite everything for each module !

Posted: Mon Sep 14, 2009 4:29 pm
by david
HI Anome,

unfortunately there is no function accessible to the Modules to programatically instantiate Modul8 UI components.

You could only show/hide group of predifined components.

But I will add this request to our feature request list.