Ejemplo n.º 1
0
 def __init__(self, parent=None, **args):
     Frame.__init__(self, parent, args)
     self.pack()
     self.tools()
     Label(self, text="Check demos").pack()
     self.vars = []
     for key in demos.keys():
         var = IntVar()
         Checkbutton(self, text=key, variable=var,
                     command=demos[key]).pack(side=LEFT)
         self.vars.append(var)
Ejemplo n.º 2
0
 def __init__(self, parent=None, **args):
     Frame.__init__(self, parent, args)
     self.pack( )
     self.tools( )
     Label(self, text="Check demos").pack( )
     self.vars = []
     for key in demos.keys( ):
         var = IntVar( )
         Checkbutton(self,
                     text=key,
                     variable=var,
                     command=demos[key]).pack(side=LEFT)
         self.vars.append(var)
Ejemplo n.º 3
0
        Scale(self,
              label='Pick demo numbe',
              command=self.onMove,
              variable=self.var,
              from_=0,
              to=len(demos) - 1,
              length=200,
              tickinterval=1,
              showvalue=YES,
              orient='horizontal').pack()
        Quitter(self).pack(side=RIGHT)
        Button(self, text="Run demo", command=self.onRun).pack(side=LEFT)
        Button(self, text="State", command=self.report).pack(side=RIGHT)

    def onMove(self, value):
        print('in onMove', value)

    def onRun(self):
        pos = self.var.get()
        print('You picked', pos)
        demo = list(demos.values())[pos]
        print(demo())

    def report(self):
        print(self.var.get())


if __name__ == '__main__':
    print(list(demos.keys()))
    Demo().mainloop()
Ejemplo n.º 4
0
        self.var = IntVar()
        Scale(self, label='Pick demo number',
                    command=self.onMove,                   # catch moves
                    variable=self.var,                     # reflects position
                    from_=0, to=len(demos)-1).pack()
        Scale(self, label='Pick demo number',
                    command=self.onMove,                   # catch moves
                    variable=self.var,                     # reflects position
                    from_=0, to=len(demos)-1,
                    length=200, tickinterval=1,
                    showvalue=YES, orient='horizontal').pack()
        Quitter(self).pack(side=RIGHT)
        Button(self, text="Run demo", command=self.onRun).pack(side=LEFT)
        Button(self, text="State",    command=self.report).pack(side=RIGHT)

    def onMove(self, value):
        print('in onMove', value)

    def onRun(self):
        pos = self.var.get()
        print('You picked', pos)
        demo = list(demos.values())[pos]    # map from position to value (3.X view)
        print(demo())                       # or demos[ list(demos.keys())[pos] ]() 

    def report(self):
        print(self.var.get())

if __name__ == '__main__':
    print(list(demos.keys()))
    Demo().mainloop()
Ejemplo n.º 5
0
 def onRun(self):
     pos = self.var.get()
     print "You picked", pos
     pick = demos.keys()[pos]  # map from position to key
     print demos[pick]()
Ejemplo n.º 6
0
            label="Pick demo number",
            command=self.onMove,  # catch moves
            variable=self.var,  # reflects position
            from_=0,
            to=len(demos) - 1,
            length=200,
            tickinterval=1,
            showvalue=YES,
            orient="horizontal",
        ).pack()
        Quitter(self).pack(side=RIGHT)
        Button(self, text="Run Demo", command=self.onRun).pack(side=LEFT)
        Button(self, text="State", command=self.report).pack(side=RIGHT)

    def onMove(self, value):
        print "in onMove", value

    def onRun(self):
        pos = self.var.get()
        print "You picked", pos
        pick = demos.keys()[pos]  # map from position to key
        print demos[pick]()

    def report(self):
        print self.var.get()


if __name__ == "__main__":
    print demos.keys()
    Demo().mainloop()
Ejemplo n.º 7
0
 def onRun(self):
     pos = self.var.get()
     print 'You picked', pos
     pick = demos.keys()[pos]  # map from position to key
     print demos[pick]()
Ejemplo n.º 8
0
            self,
            label='Pick demo number',
            command=self.onMove,  # catch moves
            variable=self.var,  # reflects position
            from_=0,
            to=len(demos) - 1,
            length=200,
            tickinterval=1,
            showvalue=YES,
            orient='horizontal').pack()
        Quitter(self).pack(side=RIGHT)
        Button(self, text="Run demo", command=self.onRun).pack(side=LEFT)
        Button(self, text="State", command=self.report).pack(side=RIGHT)

    def onMove(self, value):
        print 'in onMove', value

    def onRun(self):
        pos = self.var.get()
        print 'You picked', pos
        pick = demos.keys()[pos]  # map from position to key
        print demos[pick]()

    def report(self):
        print self.var.get()


if __name__ == '__main__':
    print demos.keys()
    Demo().mainloop()