Why Tkinter is not allowed in Modul8 ?
  • User avatar
    Anome
    activ8 member
    Posts: 63
    Joined: Sun Sep 02, 2007 11:50 am
    Location: paris
    Contact:

    Why Tkinter is not allowed in Modul8 ?

    by Anome » Mon Mar 02, 2009 10:14 am

    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 :)
    Image . . . . Image
  • User avatar
    Anome
    activ8 member
    Posts: 63
    Joined: Sun Sep 02, 2007 11:50 am
    Location: paris
    Contact:

    by Anome » Sun Sep 13, 2009 11:48 am

    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)
    Image . . . . Image
  • ilan

    by ilan » Sun Sep 13, 2009 4:57 pm

    I'll check with our team why.
  • User avatar
    david
    garageCube team
    Posts: 217
    Joined: Tue Jan 08, 2008 1:14 am
    Location: Antibes, France

    by david » Mon Sep 14, 2009 2:23 pm

    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.
  • User avatar
    Anome
    activ8 member
    Posts: 63
    Joined: Sun Sep 02, 2007 11:50 am
    Location: paris
    Contact:

    by Anome » Mon Sep 14, 2009 3:24 pm

    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 !
    Image . . . . Image
  • User avatar
    david
    garageCube team
    Posts: 217
    Joined: Tue Jan 08, 2008 1:14 am
    Location: Antibes, France

    by david » Mon Sep 14, 2009 4:29 pm

    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.

Who is online

Users browsing this forum: No registered users and 9 guests