- PyGTK - Drag and Drop
- PyGTK - Timeout
- PyGTK - Ruler Class
- PyGTK - Clipboard Class
- PyGTK - Calendar Class
- PyGTK - SpinButton Class
- PyGTK - DrawingArea Class
- PyGTK - Image Class
- PyGTK - Arrow Class
- PyGTK - Scrolledwindow Class
- PyGTK - Viewport Class
- PyGTK - ProgressBar Class
- PyGTK - Statusbar Class
- PyGTK - Paned Class
- PyGTK - TreeView Class
- PyGTK - AspectFrame Class
- PyGTK - Frame Class
- PyGTK - Notebook Class
- PyGTK - File Chooser Dialog
- PyGTK - Color Selection Dialog
- PyGTK - Font Selection Dialog
- PyGTK - AboutDialog Class
- PyGTK - MessageDialog Class
- PyGTK - Dialog Class
- PyGTK - Scrollbar Class
- PyGTK - Scale Class
- PyGTK - Range Class
- PyGTK - Adjustment Class
- PyGTK - Toolbar Class
- PyGTK - MenuBar, Menu & MenuItem
- PyGTK - RadioButton Class
- PyGTK - CheckButton Class
- PyGTK - ToggleButton Class
- PyGTK - ComboBox Class
- PyGTK - Layout Class
- PyGTK - EventBox Class
- PyGTK - Alignment Class
- PyGTK - ButtonBox Class
- PyGTK - Box Class
- PyGTK - Containers
- PyGTK - Event Handling
- PyGTK - Signal Handling
- PyGTK - Entry Class
- PyGTK - Label CLass
- PyGTK - Button Class
- PyGTK - Window Class
- PyGTK - Important Classes
- PyGTK - Hello World
- PyGTK - Environment
- PyGTK - Introduction
- PyGTK - Home
PyGTK Useful Resources
Selected Reading
- Who is Who
- Computer Glossary
- HR Interview Questions
- Effective Resume Writing
- Questions and Answers
- UPSC IAS Exams Notes
PyGTK - Arrow Class
The gtk.Arrow object is used to draw simple arrow pointing towards four cardinal directions. This class is inherited from the gtk.Misc class and the object will occupy any space allocated it, for instance, a Label or Button widget.
Typically, Arrow object is created using the following constructor −
Arr = gtk.Arrow(arrow_type, shadow_type)
The predefined arrow_type constants are −
gtk.ARROW_UP
gtk.ARROW_DOWN
gtk.ARROW_LEFT
gtk.ARROW_RIGHT
The predefined shadow_type constants are psted in the following table −
gtk.SHADOW_NONE | No outpne. |
gtk.SHADOW_IN | The outpne is beveled inward. |
gtk.SHADOW_OUT | The outpne is beveled outward pke a button. |
gtk.SHADOW_ETCHED_IN | The outpne itself is an inward bevel, but the frame bevels outward. |
gtk.SHADOW_ETCHED_OUT | The outpne is an outward bevel, frame bevels inward. |
Example
In the following example, four Button widgets are added to an Hbox. On top of each button, a gtk.Arrow object pointing UP, DOWN, LEFT and RIGHT respectively is placed. The HBOX container is placed at the bottom of the toplevel window with the help of an Apgnment container.
Observe the code −
import gtk class PyApp(gtk.Window): def __init__(self): super(PyApp, self).__init__() self.set_title("Arrow Demo") self.set_size_request(300, 200) self.set_position(gtk.WIN_POS_CENTER) vbox = gtk.VBox(False, 5) hbox = gtk.HBox(True, 3) vapgn = gtk.Apgnment(0, 1, 0, 0) vbox.pack_start(vapgn) arr1 = gtk.Arrow(gtk.ARROW_UP, gtk.SHADOW_NONE) arr2 = gtk.Arrow(gtk.ARROW_DOWN, gtk.SHADOW_NONE) arr3 = gtk.Arrow(gtk.ARROW_LEFT, gtk.SHADOW_NONE) arr4 = gtk.Arrow(gtk.ARROW_RIGHT, gtk.SHADOW_NONE) btn1 = gtk.Button() btn1.add(arr1) btn2 = gtk.Button() btn2.add(arr2) btn3 = gtk.Button() btn3.add(arr3) btn4 = gtk.Button() btn4.add(arr4) hbox.add(btn1) hbox.add(btn2) hbox.add(btn3) hbox.add(btn4) hapgn = gtk.Apgnment(0.5, 0.5, 0, 0) hapgn.add(hbox) vbox.pack_start(hapgn, False, True, 10) self.add(vbox) self.connect("destroy", gtk.main_quit) self.show_all() PyApp() gtk.main()
The above code will generate the following output −
Advertisements