def ShotWid():
""" this simple widget accepts a shot and sets the current one
It is a function in the IntegerCtl class, so it communicates with
its vars easily and calls do_shot to update the shot. THe
shot pulldown stops working in python (ordinary) after 1
pulldown?
"""
global hist_box, select_box, wild_box
# root=Tix.Tk(className='ShotSelect') # was here but needs to
# be in effect before Tix.StringVar() is called
top = Tix.Frame(root, bd=1, relief=Tix.RAISED)
hist_box=Tix.ComboBox(top, label="Shot", editable=True, history=True,
variable=shot_string, command=do_shot,
options='entry.width 8 listbox.height 10 ')
hist_box.pack(side=Tix.TOP, anchor=Tix.W)
hist_box.set_silent('33373')
hist_balloon=Tix.Balloon(top)
hist_balloon.bind_widget(hist_box, balloonmsg='Choose or enter shot number, valid ones are saved here')
wild_box=Tix.ComboBox(top, label="Filter", editable=1, history=1,
variable=wild_string, command=update_select,
options='entry.width 20 listbox.height 5 ') # allow room for expressions
wild_box.pack(side=Tix.TOP, anchor=Tix.W)
wild_balloon=Tix.Balloon(top)
wild_balloon.bind_widget(wild_box,
balloonmsg='Choose or enter new filter in one of three forms,' +
'a Python expression (must have () or []), '+
'a directory specification including a * or ' +
'the name of a file containing lines beginning with a shot number. '
'Results can be chosen using "Filtered Shots"')
select_box=Tix.ComboBox(top, label="Filtered Shots", history=False,
variable=select_string, command=do_shot,
options='entry.width 8 listbox.height 40 ')
btn = Tix.Button(select_box, text='Clear',command=clear_select)
btn.pack(anchor=Tix.CENTER)
select_box.pack(side=Tix.TOP, anchor=Tix.W)
select_balloon=Tix.Balloon(top)
select_balloon.bind_widget(select_box, balloonmsg='pull down to find a shot selected by "Filter""')
#wild_box.set_silent('MP1') # not silent - want it all to happen, but setvar doesn't work
update_select(partial_name=wild_card)
top.pack(side=Tix.TOP, fill=Tix.BOTH, expand=1)
# no need in pylab provided tkagg is used root.mainloop()
# in fact, may conflict and block - hard to sort out what blocks and when, why
评论列表
文章目录