1 Mar 2005 15:08
using list elements in menu construction?
Stewart Midwinter <stewart.midwinter <at> gmail.com>
2005-03-01 14:08:47 GMT
2005-03-01 14:08:47 GMT
Hi all:
I want to use a list to contain variables in a series of option-menu
toggles. I've got 15 options to set, so I would like to use a single
for loop to draw the 15 menu items and use a list containing Tkinter
IntVar instances to keep track of the value of these options. But,
Tkinter doesn't seem to like me using a list member as the variable in
the menu. Is there a way to do what I want?
Here's a sample app with the offending behaviour:
#test-opts.py
import sys, thread, string, os, time
class rsyncApp:
def __init__(self, parent):
'''define rsync defaults; get from settings file if it exists'''
self.font = ('Helvetica', 10) #default font
os.chdir(folder)
def drawGUI(self, parent):
'''Create and pack the MenuBar.'''
menuBar = Pmw.MenuBar(parent,
hull_relief = 'raised',
hull_borderwidth = 1)
menuBar.pack(fill = 'x')
self.menuBar = menuBar
# Add some buttons to the MenuBar.
menuBar.addmenu('File', 'Connect or quit')
(Continue reading)
>might be a bug in the Python binding. does the following "direct" call
>work as expected?
>
> widget.tk.call(widget, "selection", "clear", fromvalue, tovalue)
>
RSS Feed