=============================== ``grail.widgets.garrow`` module =============================== .. include:: ../../version.h .. include:: ref.h .. contents:: Table of Contents :backlinks: top ----------- Description ----------- Contains the GArrow widget commonly used in the GComboBox and GSpinner widgets. ------- Example ------- The following example illustrates how the :c:`GArrow` widget is used to help create a simplified version of the :c:`GSpinner` widget. .. Python:: from grail.rtv import IntegerRTV from grail.widgets import GTextEntry var = IntegerRTV(name="__garrow_test") # event handlers def _onup(): var.set(var.get() + 1) def _ondown(): var.set(var.get() - 1) root = Tkinter.Tk() up = GArrow(root, height=7, width=14, direction='up') down = GArrow(root, height=7, width=14, direction='down') objsignal.listen(down, const.sigON_CLICK, None, _ondown) objsignal.listen(up, const.sigON_CLICK, None, _onup) te = GTextEntry(root, rtv=var) te.grid(row=0, column=0, rowspan=2, sticky=Tkinter.NSEW) up.grid(row=0, column=1, sticky=Tkinter.NSEW) down.grid(row=1, column=1, sticky=Tkinter.NSEW) root.mainloop() ------------- GArrow Widget ------------- The :c:`GArrow` widget inherits from, * :c:`gwidget.GWidget` (grail.widgets.gwidget_) * :c:`objsignal.Emitter` (grail.objsignal_) class :dc:`GArrow([parent, **kws])` Draws a simple arrow on a canvas widget. This widget attempts to encapsulate all the logic necessary for drawing an arrow button. Examples of an arrow button are on the spinners and comboboxes. Keywords: Inherits all the :c:`Tkinter.Canvas` keywords. The most important of :c:`Tkinter.Canvas` keywords are :a:`height` and :a:`width`. Additional keywords are as follows, :a:`direction` The direction the arrow points, either :d:`const.strUP`, :d:`const.strDOWN`, :d:`const.strLEFT`, :d:`const.strRIGHT`. :a:`fg`, :a:`foreground` Specifies the color of the arrow. Defaults to :d:`const.colorENABLED_FOREGROUND`. Signal: :d:`const.sigON_CLICK` Generated whenever the arrow button is clicked by the user. Components: None. :df:`bindarrow()` *Internal usage only*. Binds the arrow to the windows events. :df:`disable()` Set the arrow to ignore user events. :df:`enable()` Allow the arrow to respond to user events. :df:`invoke()` Causes the arrow to perform an a button down then up event. :df:`unbindarrow()` *Internal usage only*. Unbinds the arrows to the windows events. :df:`updatevars()` No RTVs on this widget; always returns 1.