- 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 - Color Selection Dialog
This is a preconfigured Dialog in PyGTK API which lets the user to select and apply color. It internally embeds a gtk.ColorSelection widget.
The gtk.ColorScelection widget presents a colow wheel, and entry boxes for color parameters such as HSV and RGB. New color can be selected by manipulating color wheel or entering color parameters. Its get_current_color is useful for further processing.
Following is the prototype of the constructor of the gtk.ColorSelectionDialog class −
dlg = gtk.ColorSelectionDialog(title)
The current selected color is obtained from the colorsel attribute. The selected color is appped to a widget using modify_fg() or modify_bg() methods.
When the ColorDialog menu button is activated, the following callback function is executed −
def on_color(self, widget): dlg = gtk.ColorSelectionDialog("Select color") col = dlg.run() sel = dlg.colorsel.get_current_color() self.text.modify_fg(gtk.STATE_NORMAL, sel)
The chosen color is appped to the text in a label widget on the window −
The following is the output −
Advertisements