Package muntjac :: Package addon :: Package colorpicker :: Module color_picker_demo
[hide private]
[frames] | no frames]

Source Code for Module muntjac.addon.colorpicker.color_picker_demo

 1   
 2  from muntjac.api import Application, Window, Label 
 3   
 4  from muntjac.addon.colorpicker.color import Color 
 5   
 6  from muntjac.addon.colorpicker.color_picker import ColorPicker 
 7   
 8   
9 -class ColorPickerDemo(Application):
10
11 - def init(self):
12 mainWindow = Window("Color Picker Demo Application") 13 label = Label("Hello Muntjac user") 14 mainWindow.addComponent(label) 15 self.setMainWindow(mainWindow) 16 17 # Create the color picker 18 cp = ColorPicker("Our ColorPicker", Color.RED) 19 mainWindow.addComponent(cp) 20 21 # Set the button caption 22 cp.setButtonCaption("Our color")
23 24 # Hide the color history 25 # cp.setHistoryVisibility(False) 26 27 # Hide the HSV tab 28 # cp.setHSVVisibility(False) 29 30 # Hide the RGB tab 31 # cp.setRGBVisibility(False) 32 33
34 - def colorChanged(self, event):
35 self.getMainWindow().showNotification("Color changed!")
36 37 38 if __name__ == '__main__': 39 from muntjac.main import muntjac 40 muntjac(ColorPickerDemo, nogui=True, forever=True, debug=True) 41