Table of Contents
Basically adds the semantics to treat a Tkinter.Button as a MineSight® Grail button within the MineSight® Grail widget library.
The following segment of code illustrates how a GButton behaves. The event chain button illustrates how you can use both the command keyword or the const.sigON_CLICK signal to handle a user button click.
# event handlers
def _onDisabledClicked():
print "Called _onDisabledClicked()"
def _onEnabledClicked():
print "Called _onEnabledClicked()"
def _onCommand(event=None):
print "Called _onCommand() (specified via keyword)"
def _onClickSignal():
print "Called _onClickSignal() (specified via ObjSig)"
root = Tkinter.Tk()
buttons = []
btn = GButton(root, text="disabled")
objsignal.listen(btn, "onClick()", None, _onDisabledClicked)
btn.disable()
btn.focus_set()
buttons.append(btn)
btn = GButton(root, text="enabled")
objsignal.listen(btn, "onClick()", None, _onEnabledClicked)
buttons.append(btn)
btn = GButton(root, text="event chain", command=_onCommand)
objsignal.listen(btn, "onClick()", None, _onClickSignal)
buttons.append(btn)
for btn in buttons:
btn.pack(fill='both', expand=1)
root.title("Demo - GButton")
root.geometry("%dx%d+%d+%d" % (200, 80, 150, 150))
root.mainloop()
Takes the Tkinter.Button and adds the enable() and disable() functions.