Hi,

I am trying to write a PyMOL plugin with radio buttons. But I am having
problems.

1) the last two radio button looks gray and checked. (I think the correct
behavior should be; only one checked and none gray) setting a different
default value (using ref_value.set()) does not change anything.

2) I always get the default value ("1" in this example) when hit the submit
button.



from Tkinter import *

def __init__(self):
    self.menuBar.addmenuitem('Plugin', 'command',

                        'Plugin name',
                        label = 'plugin',

                        command = lambda : draw_gui())

def draw_gui():
    global v
    master = Tk()

    master.title(' title ')
    Button(master, text='Submit', command=submit).pack(side=BOTTOM)

    v = StringVar()
    v.set(1)

    Radiobutton(master, text='option 1', variable=v, value=1).pack(side=LEFT)

    Radiobutton(master, text='option 2', variable=v, value=2).pack(side=LEFT)

    Radiobutton(master, text='option 3', variable=v, value=3).pack(side=LEFT)

    master.mainloop()


def submit():

    print v.get()

The code runs as expected in a terminal [I comment the
"__init__(self)" function and

I add the line "if __name__ == "__main__": draw_gui()"]


Thanks in advance,

Osvaldo.
------------------------------------------------------------------------------
BlackBerry® DevCon Americas, Oct. 18-20, San Francisco, CA
The must-attend event for mobile developers. Connect with experts. 
Get tools for creating Super Apps. See the latest technologies.
Sessions, hands-on labs, demos & much more. Register early & save!
http://p.sf.net/sfu/rim-blackberry-1
_______________________________________________
PyMOL-users mailing list (PyMOL-users@lists.sourceforge.net)
Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users
Archives: http://www.mail-archive.com/pymol-users@lists.sourceforge.net

Reply via email to