コード例 #1
0
ファイル: gui10.py プロジェクト: Stever1975/Scriptorium
    def __init__(self,**params):
        gui.Table.__init__(self,**params)
        fg = (255,255,255)

        self.tr()
        self.td(gui.Label("Phil's Pygame GUI",color=fg),colspan=2)
        
        self.tr()
        self.td(gui.Label("Speed: ",color=fg),align=1)
        e = gui.HSlider(100,-500,500,size=20,width=100,height=16,name='speed')
        self.td(e)
        
        self.tr()
        self.td(gui.Label("Size: ",color=fg),align=1)
        e = gui.HSlider(2,1,5,size=20,width=100,height=16,name='size')
        self.td(e)
        
        self.tr()
        self.td(gui.Label("Quantity: ",color=fg),align=1)
        e = gui.HSlider(100,1,1000,size=20,width=100,height=16,name='quantity')
        self.td(e)
        
        self.tr()
        self.td(gui.Label("Color: ",color=fg),align=1)
        
        
        default = "#ffffff"
        color = gui.Color(default,width=64,height=10,name='color')
        color_d = ColorDialog(default)
                
        color.connect(gui.CLICK,color_d.open,None)
        color_d.connect(gui.CHANGE,gui.action_setvalue,(color_d,color))
        self.td(color)
        
        self.tr()
        self.td(gui.Label("Full Screen: ",color=fg),align=1)
        self.td(gui.Switch(value=False,name='fullscreen'))
        
        self.tr()
        self.td(gui.Label("Warp Speed: ",color=fg),align=1)
        self.td(gui.Switch(value=False,name='warp'))
コード例 #2
0
    def __init__(self,**params):
        title = gui.Label("New Picture...")
        
        ##Note how the global variables are set for the scripting of HTML
        ##::        
        picker = ColorDialog("#ffffff")
        doc = html.HTML(globals={'gui':gui,'dialog':self,'picker':picker},data="""
<form id='form'>

<table>

<tr><td colspan='2' align='center'>
Size
<tr><td colspan='2' align='center'>
<table>
<tr><td align=right>Width: <td><input type='text' size='4' value='256' name='width'>
<tr><td align=right>Height: <td><input type='text' size='4' value='256' name='height'>
</table>

<tr><td>Format<td>Background

<tr><td>
<input type='radio' name='format' value='rgb' checked> RGB<br>
<input type='radio' name='format' value='bw'> Grayscale
<td>
<input type='radio' name='background' value='#000000'> Black<br>
<input type='radio' name='background' value='#ffffff' checked> White<br>
<input type='radio' name='background' value='custom'> <object type='gui.Color' width=48 height=16 value='#ffffff' name='custom' border=1 onclick='picker.open()'>

<tr><td colspan=2><input type='button' value='Okay' onclick='dialog.send(gui.CHANGE)'> <input type='button' value='Cancel' onclick='dialog.close()'>

</table>

""")
        gui.Dialog.__init__(self,title,doc)
        
        picker.connect(gui.CHANGE,gui.action_setvalue,(picker,doc['form']['custom']))
        ##
        
        self.value = doc['form']
コード例 #3
0
ファイル: gui9.py プロジェクト: JonahBrooks/Portfolio
    def __init__(self,**params):
        gui.Desktop.__init__(self,**params)
        
        self.connect(gui.QUIT,self.quit,None)
        
        c = gui.Container(width=640,height=480)
        spacer = 8
        
        self.fname = 'untitled.tga'
        
        self.new_d = NewDialog()
        self.new_d.connect(gui.CHANGE,self.action_new,None)
        self.open_d = OpenDialog()
        self.open_d.connect(gui.CHANGE,self.action_open,None)
        self.save_d = SaveDialog()
        self.save_d.connect(gui.CHANGE,self.action_saveas,None)
        self.quit_d = QuitDialog()
        self.quit_d.connect(QUIT,self.quit,None)
        
        self.help_d = HelpDialog()
        self.about_d = AboutDialog()
        
        ##Initializing the Menus, we connect to a number of Dialog.open methods for each of the dialogs.
        ##::
        menus = gui.Menus([
            ('File/New',self.new_d.open,None),
            ('File/Open',self.open_d.open,None),
            ('File/Save',self.action_save,None),
            ('File/Save As',self.save_d.open,None),
            ('File/Exit',self.quit_d.open,None),
            ('Help/Help',self.help_d.open,None),
            ('Help/About',self.about_d.open,None),
            ])
        ##
        c.add(menus,0,0)
        menus.rect.w,menus.rect.h = menus.resize()
        #print 'menus',menus.rect
        
        ##We utilize a Toolbox.  The value of this widget determins how drawing is done in the Painter class.
        ##::
        self.mode = mode = gui.Toolbox([
            ('Draw','draw'),
            ('Box','box'),
            ('Circle','circle'),
            ('Cuzco','cuzco'),
            ],cols=1,value='draw')
        ##
        c.add(mode,0,menus.rect.bottom+spacer)
        mode.rect.x,mode.rect.y = mode.style.x,mode.style.y
        mode.rect.w,mode.rect.h = mode.resize()
        #mode._resize()
        
        default = "#000000"
        self.color = color = gui.Color(default,width=mode.rect.w,height=mode.rect.w)
        self.color_d = ColorDialog(default)
        
        color.connect(gui.CLICK,self.color_d.open,None)
        self.color_d.connect(gui.CHANGE,gui.action_setvalue,(self.color_d,self.color))
        c.add(self.color,0,mode.rect.bottom+spacer)
        self.color.rect.w,self.color.rect.h = self.color.resize()
        #self.color._resize()

        self.painter = Painter(width=c.rect.w-mode.rect.w-spacer*2,height=c.rect.h-menus.rect.h-spacer*2,style={'border':1})
        c.add(self.painter,mode.rect.w+spacer,menus.rect.h+spacer)
        self.painter.init({'width':256,'height':256,'color':'#ffffff'})
        self.painter.rect.w,self.painter.rect.h = self.painter.resize()
        #self.painter._resize()

        welcome_d = WelcomeDialog()
        self.connect(gui.INIT,welcome_d.open,None)
        
        self.widget = c
コード例 #4
0
ファイル: gui10.py プロジェクト: garred/only_fighters
    def __init__(self,**params):
        gui.Table.__init__(self,**params)

        def fullscreen_changed(btn):
            #pygame.display.toggle_fullscreen()
            print("TOGGLE FULLSCREEN")

        def stars_changed(slider):
            n = slider.value - len(stars)
            if n < 0:
                for i in range(n,0): 
                    stars.pop()
            else:
                for i in range(0,n):
                    stars.append([random.randrange(-WIDTH*span,WIDTH*span),
                                  random.randrange(-HEIGHT*span,HEIGHT*span),
                                  random.randrange(1,dist)])

        fg = (255,255,255)

        self.tr()
        self.td(gui.Label("Phil's Pygame GUI",color=fg),colspan=2)
        
        self.tr()
        self.td(gui.Label("Speed: ",color=fg),align=1)
        e = gui.HSlider(100,-500,500,size=20,width=100,height=16,name='speed')
        self.td(e)
        
        self.tr()
        self.td(gui.Label("Size: ",color=fg),align=1)
        e = gui.HSlider(2,1,5,size=20,width=100,height=16,name='size')
        self.td(e)
        
        self.tr()
        self.td(gui.Label("Quantity: ",color=fg),align=1)
        e = gui.HSlider(100,1,1000,size=20,width=100,height=16,name='quantity')
        e.connect(gui.CHANGE, stars_changed, e)
        self.td(e)
        
        self.tr()
        self.td(gui.Label("Color: ",color=fg),align=1)
        
        
        default = "#ffffff"
        color = gui.Color(default,width=64,height=10,name='color')
        color_d = ColorDialog(default)

        color.connect(gui.CLICK,color_d.open,None)
        self.td(color)
        def update_col():
            color.value = color_d.value
        color_d.connect(gui.CHANGE,update_col)
        
        btn = gui.Switch(value=False,name='fullscreen')
        btn.connect(gui.CHANGE, fullscreen_changed, btn)

        self.tr()
        self.td(gui.Label("Full Screen: ",color=fg),align=1)
        self.td(btn)
        
        self.tr()
        self.td(gui.Label("Warp Speed: ",color=fg),align=1)
        self.td(gui.Switch(value=False,name='warp'))
コード例 #5
0
    def __init__(self,**params):
        gui.Desktop.__init__(self,**params)
        
        self.connect(gui.QUIT,self.quit,None)
        
        c = gui.Container(width=640,height=480)
        spacer = 8
        
        self.fname = 'untitled.tga'
        
        self.new_d = NewDialog()
        self.new_d.connect(gui.CHANGE,self.action_new,None)
        self.open_d = OpenDialog()
        self.open_d.connect(gui.CHANGE,self.action_open,None)
        self.save_d = SaveDialog()
        self.save_d.connect(gui.CHANGE,self.action_saveas,None)
        self.quit_d = QuitDialog()
        self.quit_d.connect(QUIT,self.quit,None)
        
        self.help_d = HelpDialog()
        self.about_d = AboutDialog()
        
        ##Initializing the Menus, we connect to a number of Dialog.open methods for each of the dialogs.
        ##::
        menus = gui.Menus([
            ('File/New',self.new_d.open,None),
            ('File/Open',self.open_d.open,None),
            ('File/Save',self.action_save,None),
            ('File/Save As',self.save_d.open,None),
            ('File/Exit',self.quit_d.open,None),
            ('Help/Help',self.help_d.open,None),
            ('Help/About',self.about_d.open,None),
            ])
        ##
        c.add(menus,0,0)
        menus.rect.w,menus.rect.h = menus.resize()
        #print 'menus',menus.rect
        
        ##We utilize a Toolbox.  The value of this widget determins how drawing is done in the Painter class.
        ##::
        self.mode = mode = gui.Toolbox([
            ('Draw','draw'),
            ('Box','box'),
            ('Circle','circle'),
            ('Cuzco','cuzco'),
            ],cols=1,value='draw')
        ##
        c.add(mode,0,menus.rect.bottom+spacer)
        mode.rect.x,mode.rect.y = mode.style.x,mode.style.y
        mode.rect.w,mode.rect.h = mode.resize()
        #mode._resize()
        
        default = "#000000"
        self.color = color = gui.Color(default,width=mode.rect.w,height=mode.rect.w)
        self.color_d = ColorDialog(default)
        
        color.connect(gui.CLICK,self.color_d.open,None)

        # Updates the toolbox color picker with the value in the color dialog box
        def change_cb(*args):
            self.color.value = self.color_d.value
        self.color_d.connect(gui.CHANGE, change_cb)

        c.add(self.color,0,mode.rect.bottom+spacer)
        self.color.rect.w,self.color.rect.h = self.color.resize()
        #self.color._resize()

        self.painter = Painter(width=c.rect.w-mode.rect.w-spacer*2,height=c.rect.h-menus.rect.h-spacer*2,style={'border':1})
        c.add(self.painter,mode.rect.w+spacer,menus.rect.h+spacer)
        self.painter.init({'width':256,'height':256,'color':'#ffffff'})
        self.painter.rect.w,self.painter.rect.h = self.painter.resize()
        #self.painter._resize()

        welcome_d = WelcomeDialog()
        self.connect(gui.INIT,welcome_d.open,None)
        
        self.widget = c
コード例 #6
0
ファイル: gui10.py プロジェクト: LightChris/BlackJack_Client
    def __init__(self, **params):
        gui.Table.__init__(self, **params)

        def fullscreen_changed(btn):
            # pygame.display.toggle_fullscreen()
            print("TOGGLE FULLSCREEN")

        def stars_changed(slider):
            n = slider.value - len(stars)
            if n < 0:
                for i in range(n, 0):
                    stars.pop()
            else:
                for i in range(0, n):
                    stars.append([random.randrange(-WIDTH * span, WIDTH * span),
                                  random.randrange(-HEIGHT * span, HEIGHT * span),
                                  random.randrange(1, dist)])

        fg = (255, 255, 255)

        self.tr()
        self.td(gui.Label("Phil's Pygame GUI", color=fg), colspan=2)

        self.tr()
        self.td(gui.Label("Speed: ", color=fg), align=1)
        e = gui.HSlider(100, -500, 500, size=20, width=100, height=16, name='speed')
        self.td(e)

        self.tr()
        self.td(gui.Label("Size: ", color=fg), align=1)
        e = gui.HSlider(2, 1, 5, size=20, width=100, height=16, name='size')
        self.td(e)

        self.tr()
        self.td(gui.Label("Quantity: ", color=fg), align=1)
        e = gui.HSlider(100, 1, 1000, size=20, width=100, height=16, name='quantity')
        e.connect(gui.CHANGE, stars_changed, e)
        self.td(e)

        self.tr()
        self.td(gui.Label("Color: ", color=fg), align=1)

        default = "#ffffff"
        color = gui.Color(default, width=64, height=10, name='color')
        color_d = ColorDialog(default)

        color.connect(gui.CLICK, color_d.open, None)
        self.td(color)

        def update_col():
            color.value = color_d.value

        color_d.connect(gui.CHANGE, update_col)

        btn = gui.Switch(value=False, name='fullscreen')
        btn.connect(gui.CHANGE, fullscreen_changed, btn)

        self.tr()
        self.td(gui.Label("Full Screen: ", color=fg), align=1)
        self.td(btn)

        self.tr()
        self.td(gui.Label("Warp Speed: ", color=fg), align=1)
        self.td(gui.Switch(value=False, name='warp'))
コード例 #7
0
ファイル: gui8.py プロジェクト: cicean/EarlyCollegeHomework
    def __init__(self,**params):
        title = gui.Label("New Picture...")
        
        ##Once a form is created, all the widgets that are added with a name
        ##are added to that form.
        ##::
        self.value = gui.Form()
        
        t = gui.Table()
        
        t.tr()
        t.td(gui.Label("Size"),align=0,colspan=2)
        
        tt = gui.Table()
        tt.tr()
        tt.td(gui.Label("Width: "),align=1)
        tt.td(gui.Input(name="width",value=256,size=4))
        tt.tr()
        tt.td(gui.Label("Height: "),align=1)
        tt.td(gui.Input(name="height",value=256,size=4))
        t.tr()
        t.td(tt,colspan=2)
        ##
        
        t.tr()
        t.td(gui.Spacer(width=8,height=8))
        t.tr()
        t.td(gui.Label("Format",align=0))
        t.td(gui.Label("Background",align=0))

        t.tr()        
        g = gui.Group(name="format",value="rgb")
        tt = gui.Table()
        tt.tr()
        tt.td(gui.Radio(g,value="rgb"))
        tt.td(gui.Label(" RGB"),align=-1)
        tt.tr()
        tt.td(gui.Radio(g,value="bw"))
        tt.td(gui.Label(" Grayscale"),align=-1)
        t.td(tt,colspan=1)
        
        g = gui.Group(name="color",value="#ffffff")
        tt = gui.Table()
        tt.tr()
        tt.td(gui.Radio(g,value="#000000"))
        tt.td(gui.Label(" Black"),align=-1)
        tt.tr()
        tt.td(gui.Radio(g,value="#ffffff"))
        tt.td(gui.Label(" White"),align=-1)
        tt.tr()
        
        default = "#ffffff"
        radio = gui.Radio(g,value="custom")
        color = gui.Color(default,width=40,height=16,name="custom")
        picker = ColorDialog(default)
        
        color.connect(gui.CLICK,gui.action_open,{'container':t,'window':picker})
        picker.connect(gui.CHANGE,gui.action_setvalue,(picker,color))

        tt.td(radio)
        tt.td(color)
        
        t.td(tt,colspan=1)
        
        t.tr()
        t.td(gui.Spacer(width=8,height=8))
        
        ##The okay button CLICK event is connected to the Dailog's 
        ##send event method.  It will send a gui.CHANGE event.
        ##::
        t.tr()
        e = gui.Button("Okay")
        e.connect(gui.CLICK,self.send,gui.CHANGE)
        t.td(e)
        ##
        
        e = gui.Button("Cancel")
        e.connect(gui.CLICK,self.close,None)
        t.td(e)
        
        gui.Dialog.__init__(self,title,t)