Пример #1
2
    def __init__(self, parent, name="X", color="red"):
        """
        Description :
          Calcul d'une vibration harmonique du type : e=a*sin(2*pi*f*t+p)
        Proprietes :
          -  un parent (classe Oscilloscope)
          -  controleurs d'amplitude, frequence, phase (classe Scale)
        Methodes :
          - update_vibration(self, event) : callback si modification de controleurs
          - compute(self,a,f,p) : calcul de vibration harmonique
        """
        Frame.__init__(self)
        self.configure(bd=1, relief="sunken")
        self.parent = parent
        self.name = name
        self.scale_A = Scale(self, length=300, orient="horizontal",
                label=name + " Amplitude", showvalue=1, from_=0, to=10,
                tickinterval=1, command=self.update_vibration)

        self.scale_P = Scale(self, length=300, orient="horizontal",
                label=name + " Phase", showvalue=1, from_=0, to=90,
                tickinterval=20, command=self.update_vibration)

        self.scale_F = Scale(self, length=300, orient="horizontal",
                label=name + " Fréquence", showvalue=1, from_=0, to=100,
                tickinterval=10, command=self.update_vibration)

        self.scale_A.pack(expand="yes", fill="both")
        self.scale_P.pack(expand="yes", fill="both")
        self.scale_F.pack(expand="yes", fill="both")
Пример #2
0
 def create_ranges(self):
     counter = 0
     for ran in RANGES:
         setattr(self, 'min_' + ran, RANGES[ran]['min'])
         setattr(self, 'max_' + ran, RANGES[ran]['max'])
         self.this_min_scale = Scale(self, label='min ' + ran, orient=HORIZONTAL,
                                     from_=getattr(self, 'min_' + ran),
                                     to=getattr(self, 'max_' + ran),
                                     resolution=RANGES[ran]['res'])
         self.this_max_scale = Scale(self, label='max ' + ran, orient=HORIZONTAL,
                                     from_=getattr(self, 'min_' + ran),
                                     to=getattr(self, 'max_' + ran),
                                     resolution=RANGES[ran]['res'])
         self.this_min_scale.set(RANGES[ran]['min_start'])
         self.this_max_scale.set(RANGES[ran]['max_start'])
         self.this_min_scale.enable = ('enable' in RANGES[ran].keys() and
                                        RANGES[ran]['enable'] or None)
         self.this_min_scale.disable = ('disable' in RANGES[ran].keys() and
                                         RANGES[ran]['disable'] or None)
         self.this_max_scale.enable = ('enable' in RANGES[ran].keys() and
                                       RANGES[ran]['enable'] or None)
         self.this_max_scale.disable = ('disable' in RANGES[ran].keys() and
                                       RANGES[ran]['disable'] or None)
         self.this_min_scale.grid(column=2, row=counter, sticky=E + W)
         self.this_max_scale.grid(column=2, row=counter + 1, sticky=E + W)
         self.this_min_scale.ref = 'min_' + ran
         self.this_max_scale.ref = 'max_' + ran
         self.this_min_scale.bind("<ButtonRelease>", self.scale_handler)
         self.this_max_scale.bind("<ButtonRelease>", self.scale_handler)
         counter += 2
Пример #3
0
    def __init__(self, parent, name="X"):
        """
        Initialisation

        parent : un oscilloscope
        name : nom du signal
        """
        Frame.__init__(self)
        self.configure(bd=1, relief="sunken")
        self.parent = parent
        self.name = name
        self.drawVar = IntVar()
        self.signal = None

        self.draw = Checkbutton(self,text="Afficher "+self.name, selectcolor=eval('self.parent.view.color_'+name), variable=self.drawVar, onvalue = 1, offvalue = 0, command=self.parent.plot_all)
        self.draw.pack()
        self.draw.select()

        self.scale_A = Scale(self, length=100, orient="horizontal",
                label=name + " Amplitude", showvalue=1, from_=0, to=10,
                tickinterval=1, command=self.update_signal)
        self.scale_A.pack(expand="yes", fill="both")

        self.scale_F = Scale(self, length=100, orient="horizontal",
                label=name + " Fréquence", showvalue=1, from_=1, to=10,
                tickinterval=1, command=self.update_signal)
        self.scale_F.pack(expand="yes", fill="both")

        self.scale_P = Scale(self, length=100, orient="horizontal",
                label=name + " Phase", showvalue=1, from_=0, to=10,
                tickinterval=1, command=self.update_signal)
        self.scale_P.pack(expand="yes", fill="both")

        
        self.bind("<Configure>",self.update_signal)
Пример #4
0
    def setup_gui(self):
        Visualiser.setup_gui(self)
        self.tk_quit.grid(row=0, column=0, sticky=W+E)
        self.tk_movie_toggle = Button(self.tk_controlFrame, text="Movie off", command=self.movie_toggle)
        self.tk_movie_toggle.grid(row=0, column=6,  sticky=W+E)
        
                
        self.tk_restart = Button(self.tk_controlFrame, text="<<<", command=self.restart, width=5)
        self.tk_restart.grid(row=1, column=0, sticky=W+E)
        self.tk_back10 = Button(self.tk_controlFrame, text="<<", command=self.back10, width=5)
        self.tk_back10.grid(row=1, column=1, sticky=W+E)
        self.tk_back = Button(self.tk_controlFrame, text="<", command=self.back, width=5)
        self.tk_back.grid(row=1, column=2, sticky=W+E)
        self.tk_pauseResume = Button(self.tk_controlFrame, text="Pause", command=self.pauseResume, width=15)
        self.tk_pauseResume.grid(row=1, column=3, sticky=W+E)
        self.tk_forward = Button(self.tk_controlFrame, text=">", command=self.forward, width=5)
        self.tk_forward.grid(row=1, column=4, sticky=W+E)
        self.tk_forward10 = Button(self.tk_controlFrame, text=">>", command=self.forward10, width=5)
        self.tk_forward10.grid(row=1, column=5, sticky=W+E)
        self.tk_forwardEnd = Button(self.tk_controlFrame, text=">>>", command=self.forwardEnd, width=5)
        self.tk_forwardEnd.grid(row=1, column=6, sticky=W+E)
        

        self.tk_frameNumber = Label(self.tk_controlFrame, text='Frame')
        self.tk_frameNumber.grid(row=2, column=0, sticky=W+E)
        self.tk_gotoFrame = Scale(self.tk_controlFrame, from_=0, to=self.maxFrameNumber, orient=HORIZONTAL)
        self.tk_gotoFrame.grid(row=2, column=1, columnspan=2, sticky=W+E)
        self.tk_stepLabel = Label(self.tk_controlFrame, text='Step')
        self.tk_stepLabel.grid(row=2, column=4, sticky=W+E)        
        self.tk_frameStep = Scale(self.tk_controlFrame, from_=0, to=self.maxFrameNumber, orient=HORIZONTAL)
        self.tk_frameStep.grid(row=2, column=5, columnspan=2, sticky=W+E)
        
        # Make the buttons stretch to fill all available space
        for i in range(7):
            self.tk_controlFrame.grid_columnconfigure(i, weight=1)
Пример #5
0
    def show_Binary(self):  ## input Thresh_Binary

        if (hasattr(self, 'ThBinary')):
            #(self.varHigh.get()> self.varLow.get())
            self.ThBinary.deiconify()
        else:
            self.ThBinary = Tk()
            self.ThBinary.geometry("350x100+350+350")
            self.ThBinary.title("Binary")
            self.scale_L = Scale(self.ThBinary,
                                 from_=255,
                                 to=0,
                                 command=self.onScale_L)
            self.scale_L.pack(side=LEFT, padx=10)

            self.varLow = IntVar()
            self.label1 = Label(self.ThBinary, text="LOW")
            self.label1.pack(side=LEFT, padx=0)

            self.scale_H = Scale(self.ThBinary,
                                 from_=255,
                                 to=0,
                                 command=self.onScale_H)
            self.scale_H.pack(side=LEFT, padx=20)

            self.varHigh = IntVar()
            self.label2 = Label(self.ThBinary, text="HIGH")
            self.label2.pack(side=LEFT, padx=1)

            binary = Button(self.ThBinary,
                            text="OK",
                            width=5,
                            background="green",
                            command=self.getdata_Binary)
            binary.pack(side=LEFT)
Пример #6
0
class TimeBase(Frame):
    def __init__(self, parent=None):
        """
        Description :
          Creation d'un controleur pour la base de temps
        Proprietes :
          - un parent (classe Oscilloscope)
          - controleur de la base de temps (classe Scale)
        Methodes :
          - update_time_base(self, event) : callback de demande de mise a jour sur l'oscilloscope
          - get_time(self) : observateur sur la valeur de la base de temps
        """
        Frame.__init__(self)
        self.configure(bd=1, relief="sunken")
        self.parent = parent
        self.scale_T = Scale(self, length=300, orient="horizontal",
                label="Temps", showvalue=1, from_=1, to=10,
                tickinterval=1, command=self.update_time_base)
        self.scale_T.pack(expand="yes", fill="both")

    def update_time_base(self, event):
        """
        Mise a jour de la base de temps
        """
        print("TimeBase.update_time_base()")
        print("Base de temps : ", self.scale_T.get())
        if not isinstance(self.parent, Tk):
            self.parent.update_time(self.scale_T.get())

    def get_time(self):
        """
        Retour :  valeur courante de la base de temps
        """
        return self.scale_T.get()
Пример #7
0
class TimeBase(Frame):
    """controleur pour la base de temps

    scale : controle de la valeur de la base de temps
    """
    def __init__(self, parent=None):
        """ initialisation

        parent : oscilloscope
        """
        Frame.__init__(self)
        self.configure(bd=1, relief="sunken")
        self.parent = parent
        self.scale = Scale(self, length=300, orient="horizontal",
                label="Temps", showvalue=1, from_=1, to=10,
                tickinterval=1, command=self.update_time_base)
        self.scale.pack(expand="yes", fill="both")

    def get_time(self):
        """valeur courante de la base de temps"""
        return self.scale.get()

    def update_time_base(self, event):
        """mise a jour de la base de temps"""
        print("TimeBase.update_time_base()")
        print("Base de temps : ", self.scale.get())
        if not isinstance(self.parent, Tk):
            self.parent.update_time(self.scale.get())
Пример #8
0
 def __init__(self,parent,bg="white"):
     self.canvas=Canvas(parent,bg=bg)
     print("parent",parent.cget("width"),parent.cget("height"))
     self.magnitude=Scale(parent,length=250,orient="horizontal",
                      label="Magnitude", sliderlength=20,
                      showvalue=0,from_=0,to=5,
                      tickinterval=25)
Пример #9
0
 def create_monitor(self):
     self.monitor_frame = LabelFrame(self, text="Monitor and Transport")
     this_cycle = Scale(self.monitor_frame, label='cycle_pos', orient=HORIZONTAL,
                      from_=1, to=16, resolution=1)
     this_cycle.disable, this_cycle.enable = (None, None)
     this_cycle.ref = 'cycle_pos'
     this_cycle.grid(column=0, row=0, sticky=E + W)
     self.updateButton = Button(self.monitor_frame,
                                text='Reload all Settings',
                                command=self.request_update)
     self.updateButton.grid(row=1, sticky=E + W)
     self.ForceCaesuraButton = Button(self.monitor_frame,
                                      text='Force Caesura',
                                      command=self.force_caesura)
     self.ForceCaesuraButton.grid(row=2, sticky=E + W)
     self.saveBehaviourButton = Button(self.monitor_frame,
                                     text='Save current behaviour',
                                     command=self.request_saving_behaviour)
     self.saveBehaviourButton.grid(row=3, sticky=E + W)
     self.saveBehaviourNameEntry = Entry(self.monitor_frame)
     self.saveBehaviourNameEntry.grid(row=4, sticky=E + W)
     self.saveBehaviourNameEntry.bind('<KeyRelease>', self.request_saving_behaviour)
     self.selected_behaviour = StringVar()
     self.selected_behaviour.trace('w', self.new_behaviour_chosen)
     self.savedBehavioursMenu = OptionMenu(self.monitor_frame,
                                         self.selected_behaviour, None,)
     self.savedBehavioursMenu.grid(row=5, sticky=E + W)
     self.monitor_frame.grid(column=0, row=10, sticky=E + W)
Пример #10
0
 def __init__(self, parent, subject):
     print("Controller : __init__")
     self.subject = subject
     self.amp = IntVar()
     self.scale_amp = Scale(parent,
                            variable=self.amp,
                            label="Amplitude",
                            orient="horizontal",
                            length=250,
                            from_=0,
                            to=5,
                            relief="sunken",
                            sliderlength=20,
                            tickinterval=1,
                            command=self.update_amplitude)
     self.freq = IntVar()
     self.scale_freq = Scale(parent,
                             variable=self.freq,
                             label="Frequence",
                             orient="horizontal",
                             length=250,
                             from_=0,
                             to=5,
                             relief="sunken",
                             sliderlength=20,
                             tickinterval=1,
                             command=self.update_frequence)
Пример #11
0
    def body(self, parent):
        """
        Overridden method defining the body of the dialog
        :param parent:
        :return:
        """
        self._floorSel = ImagePicker(parent, "Floor Texture:",
                                     default=self._entries["floor_texture"], auto_move=True, move_fold="Data")
        self._floorSel.grid(row=0, columnspan=4)
        self._skySel = ImagePicker(parent, "Sky Texture:", default=self._entries["sky_texture"], auto_move=True, move_fold="Data")
        self._skySel.grid(row=1, columnspan=4)

        Label(parent, text="Wall Height:", width=10, anchor=W).grid(row=2, column=0, sticky=W)
        Label(parent, text="Edge Width:", width=10, anchor=W).grid(row=3, column=0, sticky=W)

        self._wallScale = Scale(parent, from_=10, to=1000, orient=HORIZONTAL)
        if self._entries["wall_height"] is not None:
            self._wallScale.set(self._entries["wall_height"])
        self._wallScale.grid(row=2, column=1, columnspan=2, sticky=W)

        self._edgeScale = Scale(parent, from_=10, to=1000, orient=HORIZONTAL)
        if self._entries["edge_width"] is not None:
            self._edgeScale.set(self._entries["edge_width"])
        self._edgeScale.grid(row=3, column=1, columnspan=2, sticky=W)

        Label(parent, text="Starting Node:", anchor=W).grid(row=4, column=0, sticky=W)
        self._start_node = Label(parent, text=self._entries["start_node"], anchor=W)
        self._start_node.grid(row=4, column=1, sticky=W)
Пример #12
0
class TimeBase(Frame):
    """
    Base de temps

    scale_time : controle  de la base de temps
    """
    def __init__(self, parent=None):
        """
        Initialisation

        parent : oscilloscope
        """
        Frame.__init__(self)
        self.configure(bd=1, relief="sunken")
        self.parent = parent
        self.scale_time = Scale(self, length=100, orient="horizontal",
                label="Temps", showvalue=1, from_=1, to=10,
                tickinterval=1, command=self.update)
        self.scale_time.pack(expand="yes", fill="both")

    def get_time(self):
        """
        recuperer la valeur courante de la base de temps
        """
        return self.scale_time.get()

    def update(self, event):
        """mise a jour de la base de temps"""
        if not isinstance(self.parent, Tk):
            self.parent.update_time(self.scale_time.get())
Пример #13
0
    def __init__(self, parent=None):
        """
        Initialisation

        parent : oscilloscope
        """
        Frame.__init__(self)
        self.configure(bd=1, relief="sunken")
        self.parent = parent
        self.scale_time = Scale(self,
                                length=100,
                                orient="horizontal",
                                label="Temps",
                                showvalue=1,
                                from_=1,
                                to=10,
                                tickinterval=1,
                                command=self.update)
        self.scale_time.pack(expand="yes", fill="both")

        # choix d'afficher lissajoux ou pas
        self.check = Checkbutton(self,
                                 text="Afficher lissajou",
                                 selectcolor=self.parent.lissajoux.color_XY,
                                 command=self.parent.plot_all,
                                 variable=self.parent.drawXY,
                                 onvalue=1,
                                 offvalue=0)
        self.check.pack(side="top", expand="yes", fill="x")
        self.check.select()
Пример #14
0
    def __init__(self, parent, name="X",color="red"):
        """ initialisation

        parent : un oscilloscope
        name : nom du signal
        """
        Frame.__init__(self)
        self.configure(bd=1, relief="sunken", background = color)
        self.parent = parent
        self.name = name
        self.color = color
        self.scale_A = Scale(self, length=300, orient="horizontal",
                label=name + " Amplitude", showvalue=1, from_=0, to=10,
                tickinterval=1, command=self.update_signal)

        self.scale_P = Scale(self, length=300, orient="horizontal",
                label=name + " Phase", showvalue=1, from_=0, to=90,
                tickinterval=20, command=self.update_signal)

        self.scale_F = Scale(self, length=300, orient="horizontal",
                label=name + " Fréquence", showvalue=1, from_=0, to=100,
                tickinterval=10, command=self.update_signal)

        self.scale_A.pack(expand="yes", fill="both")
        self.scale_P.pack(expand="yes", fill="both")
        self.scale_F.pack(expand="yes", fill="both")
Пример #15
0
    def __init_motor(self):
        self.w_lf_motor = LabelFrame(self.window, text=u'Моторы')
        self.w_scale_motor1 = Scale(self.w_lf_motor, from_=-255, to=255)
        self.w_scale_motor2 = Scale(self.w_lf_motor, from_=-255, to=255)

        self.w_lf_motor.place(relx=0, rely=0, relwidth=1, relheight=0.3)
        self.w_scale_motor1.place(relx=0, rely=0, relwidth=1, relheight=1)
        self.w_scale_motor2.place(relx=0.5, rely=0, relwidth=1, relheight=1)
Пример #16
0
    def __init__(self, parent):
        Frame.__init__(self, parent)
        self.result = 0
        self.master.title("This is a test")
        self.master.minsize(width=600, height=800)
        #self.master.

        self.prompt = Label(self,
                            text="Enter a number:",
                            anchor="w",
                            fg="#984301")
        self.entry = Entry(self, width=50, highlightcolor="red")
        self.submit = Button(self, text="Submit", command=self.calculate)
        self.exit = Button(self, text="Exit", command=parent.destroy, fg="red")
        self.output = Label(self, text="")
        self.menu = Menu(self, title="Menu test", bg="black")
        self.canvas = Canvas(self,
                             cursor="circle",
                             highlightcolor="blue",
                             bg="#019bf0")

        self.button1 = Button(self, text = "tast antum", bg = "red", fg = "green", command = self.newWindow, \
              activebackground = "red", activeforeground = "blue", relief = "sunken", cursor = "dot")

        self.newFrame = Frame(self, bg="green", highlightcolor="blue")
        self.button2 = Button(self.newFrame, text="This is a tast")
        self.button2.grid()
        self.scale = Scale(self,
                           from_=50,
                           to_=60,
                           orient="horizontal",
                           digits=3,
                           resolution=0.25,
                           highlightcolor="red",
                           command=self.calculate)
        self.scale.pack()
        self.open_file_button = Button(self,
                                       text="Open File",
                                       command=self.openFile)

        self.prompt.pack(side="top", fill="x")
        self.entry.pack(side="top", fill="x")
        self.output.pack(side="top", fill="x", expand=True)
        self.submit.pack(side="right")
        self.exit.pack(side="left")
        self.button1.pack(fill="x")
        self.newFrame.pack(side="bottom", fill="x", expand=True)
        self.button2.grid()
        self.canvas.pack()
        self.open_file_button.pack()
        #self.slider.pack()

        #self.tk = Tkinter.Tk()
        #self.tk.withdrow()
        #self.file_path = Tkinter.filedialog.askopenfilename()
        #print("test")
        self.entry.insert(string="3", index=0)
Пример #17
0
 def __init__(self, parent=None):
     Frame.__init__(self, parent)
     self.pack(side=BOTTOM, anchor=S, fill=X)
     self.scale = Scale(self,
                        from_=0,
                        to=1,
                        sliderlength=10,
                        showvalue=YES,
                        tickinterval=10,
                        orient='horizontal')
     self.scale.pack(fill=X)
Пример #18
0
    def __init__(self, parent=None):
        """
        Initialisation

        parent : oscilloscope
        """
        Frame.__init__(self)
        self.configure(bd=1, relief="sunken")
        self.parent = parent
        self.scale_time = Scale(self, length=100, orient="horizontal",
                label="Temps", showvalue=1, from_=1, to=10,
                tickinterval=1, command=self.update)
        self.scale_time.pack(expand="yes", fill="both")
Пример #19
0
    def initUI(self):
        self.parent.title("Scale")
        self.style = Style()
        self.style.theme_use("default")

        self.pack(fill=BOTH, expand=1)

        scale = Scale(self, from_=0, to=100, command=self.onScale)
        scale.pack(side=LEFT, padx=15)

        self.var = IntVar()
        self.label = Label(self, text=0, textvariable=self.var)
        self.label.pack(side=LEFT)
Пример #20
0
def FDL(k, fName):
    """Infitie loop function which constantly runs the display given
    the file name of the sequences and an initial k"""

    global kInput
    #Gets the initial de Bruijn Graph
    fdlNodes, minSeqLen = getFDLNodes(k, fName)
    #Sets up kInput to the appriate scale (3 to the shortest length - 1 ) to ensure
    #   all sequence reads are always included
    if not kInput:
        minSeqLen -= 1
        kInput = Scale(root,
                       from_=3,
                       to=minSeqLen,
                       orient=HORIZONTAL,
                       label="K",
                       relief=FLAT)
        kInput.set(k)  #sets the initial k value
        kInput.pack(side=LEFT, padx=50, pady=10)

    #generates all lines from the initial graph
    lines = addLines(fdlNodes)
    #starts inifinite recursive loop for redraw function
    move_nodes(fdlNodes, kInput.get(), kInput.get(), lines, root, fName)
    #starts display
    root.mainloop()
class JoystickFrame(LabelFrame):
    def __init__(self, master, tracker, text="Joystick", **options):
        LabelFrame.__init__(self, master, text=text, **options)
        self.tracker = tracker

        self.width = 400
        self.height = 400
        self.canvas = Canvas(self, height=self.height, width=self.width)
        self.canvas.grid()
        self.canvas.create_oval((self.width/2 - 3, self.height/2 - 3,
                                 self.width/2 + 3, self.height/2 + 3))
        self.canvas.bind("<Button-1>",
                         bg_caller(lambda event: self.move_tracker(event)))
        self.canvas.bind("<Motion>", self.update_label)

        self.motion_label = Label(self, text="",
                                  font=tkFont.Font(family="Courier"))
        self.motion_label.grid()

        f = LabelFrame(self, text="Sensitivity")
        self.sensitivity_scale = Scale(f, from_=0, to=10,
                                       resolution=0.01,
                                       orient=HORIZONTAL,
                                       length=self.width)
        self.sensitivity_scale.set(5)
        self.sensitivity_scale.grid()
        f.grid()

    @property
    def sensitivity(self):
        return self.sensitivity_scale.get() / 2000.

    def get_delta(self, event):
        dx = event.x - int(self.canvas['width'])/2.
        dy = event.y - int(self.canvas['height'])/2.
        dx_rad = dx*self.sensitivity
        dy_rad = dy*self.sensitivity
        dtheta = dy_rad
        dphi = -dx_rad
        return (dtheta, dphi)

    def update_label(self, event):
        dtheta, dphi = self.get_delta(event)
        self.motion_label.configure(text="<{:8.5f}, {:8.5f}>".format(dtheta,
                                                                     dphi))

    def move_tracker(self, event):
        dtheta, dphi = self.get_delta(event)
        self.tracker.move(0, dtheta, dphi)
        logger.info("Moved tracker by ({}, {})".format(dtheta, dphi))
Пример #22
0
    def __init__(self,parent,view,lissajou,subjectSig,subjects):

        self.cursorFrame = Frame(parent)
        self.selectionFrame = Frame(self.cursorFrame)
        self.view = view
        self.lissajou = lissajou
        self.subjects = subjects
        self.subjectSig=subjectSig
        self.amp=IntVar()
        self.scale_amp=Scale(self.cursorFrame,variable=self.amp,
                          label="Amplitude",
                          orient="horizontal",length=250,from_=0,to=10,
                          sliderlength=50,tickinterval=1,showvalue=0,
                          command=self.update)
        self.freq=IntVar()
        self.scale_freq=Scale(self.cursorFrame,variable=self.freq,
                          label="Frequence",
                          orient="horizontal",length=250,from_=0,to=10,
                          sliderlength=50,tickinterval=0,showvalue=0,
                          command=self.update)
        self.offset=DoubleVar()
        self.scale_offset=Scale(self.cursorFrame,variable=self.offset,
                          label="Offset",
                          orient="horizontal",length=250,from_=-10.0,to=10.0,
                          sliderlength=50,tickinterval=5,showvalue=0,
                          command=self.update)

        self.phase=IntVar()
        self.scale_phase=Scale(self.cursorFrame,variable=self.phase,
                          label="Phase",
                          orient="horizontal",length=250,from_=-90,to=90,
                          sliderlength=10,tickinterval=45,showvalue=0,
                          command=self.update)


        self.voltVar = DoubleVar()
        self.voltVar.set(1)
        self.button1 = Radiobutton(self.selectionFrame, text="1V", variable=self.voltVar,
                                    value=1.0*5.0,command =lambda:self.update(None))
        self.button1.select()

        self.button2 = Radiobutton(self.selectionFrame, text="2V", variable=self.voltVar,
                                    value=2.0*5.0, command =lambda:self.update(None))

        self.button5 = Radiobutton(self.selectionFrame, text="5V", variable=self.voltVar,
                                    value=5.0*5.0, command =lambda:self.update(None))

        self.isOffsetVar= IntVar()
        self.isOffset = Checkbutton(self.selectionFrame,text = "Offset",variable = self.isOffsetVar,
                                    command =lambda:self.update(None))
Пример #23
0
class TimeBase(Frame):
    """
    Base de temps

    scale_time : controle  de la base de temps
    """
    def __init__(self, parent=None):
        """
        Initialisation

        parent : oscilloscope
        """
        Frame.__init__(self)
        self.configure(bd=1, relief="sunken")
        self.parent = parent
        self.scale_time = Scale(self,
                                length=100,
                                orient="horizontal",
                                label="Temps",
                                showvalue=1,
                                from_=1,
                                to=10,
                                tickinterval=1,
                                command=self.update)
        self.scale_time.pack(expand="yes", fill="both")

        # choix d'afficher lissajoux ou pas
        self.check = Checkbutton(self,
                                 text="Afficher lissajou",
                                 selectcolor=self.parent.lissajoux.color_XY,
                                 command=self.parent.plot_all,
                                 variable=self.parent.drawXY,
                                 onvalue=1,
                                 offvalue=0)
        self.check.pack(side="top", expand="yes", fill="x")
        self.check.select()

    def get_time(self):
        """
        recuperer la valeur courante de la base de temps
        """
        return self.scale_time.get()

    def update(self, event):
        """mise a jour de la base de temps"""
        print("TimeBase.update_time_base()")
        print("Base de temps : ", self.scale_time.get())
        if not isinstance(self.parent, Tk):
            self.parent.update_time(self.scale_time.get())
Пример #24
0
    def __init__(self, parent, text, relx, rely):
        # making parameters into attributes
        self.parent = parent
        self.text = text
        self.relx = relx
        self.rely = rely

        # creating Tkinter variables
        self.l_val = StringVar()

        Scale.__init__(self, self.parent)

        self.scale_configure_()
        self.scale_place_()
        self.label_create_()
    def __init__(self, master, tracker, text="Joystick", **options):
        LabelFrame.__init__(self, master, text=text, **options)
        self.tracker = tracker

        self.width = 400
        self.height = 400
        self.canvas = Canvas(self, height=self.height, width=self.width)
        self.canvas.grid()
        self.canvas.create_oval((self.width/2 - 3, self.height/2 - 3,
                                 self.width/2 + 3, self.height/2 + 3))
        self.canvas.bind("<Button-1>",
                         bg_caller(lambda event: self.move_tracker(event)))
        self.canvas.bind("<Motion>", self.update_label)

        self.motion_label = Label(self, text="",
                                  font=tkFont.Font(family="Courier"))
        self.motion_label.grid()

        f = LabelFrame(self, text="Sensitivity")
        self.sensitivity_scale = Scale(f, from_=0, to=10,
                                       resolution=0.01,
                                       orient=HORIZONTAL,
                                       length=self.width)
        self.sensitivity_scale.set(5)
        self.sensitivity_scale.grid()
        f.grid()
Пример #26
0
 def create_scales(self):
     counter = 0
     for sca in SCALES:
         label = SCALES[sca]['label'] if 'label'  in SCALES[sca].keys() else sca
         setattr(self, 'min_' + sca, SCALES[sca]['min'])
         setattr(self, 'max_' + sca, SCALES[sca]['max'])
         self.this_scale = Scale(self, label=label, orient=HORIZONTAL,
                                 from_=getattr(self, 'min_' + sca),
                                 to=getattr(self, 'max_' + sca),
                                 resolution=SCALES[sca]['res'])
         self.this_scale.set(SCALES[sca]['start'])
         self.this_scale.enable = ('enable' in SCALES[sca].keys() and
                                   SCALES[sca]['enable'] or None)
         self.this_scale.disable = ('disable' in SCALES[sca].keys() and
                                   SCALES[sca]['disable'] or None)
         if 'pos' in SCALES[sca].keys():
             pos = SCALES[sca]['pos']
             col = pos['c']
             row = pos['r']
         else:
             row = counter
             col = 1
             counter += 1
         self.this_scale.grid(column=col, row=row, sticky=E + W)
         self.this_scale.ref = sca
         self.this_scale.bind("<ButtonRelease>", self.scale_handler)
Пример #27
0
    def initialize(self):
        self.grid()
        self.entryVariable = StringVar()
        self.entry = Entry(self, textvariable=self.entryVariable)
        self.entry.grid(column=0,row=0,sticky='EW')
        self.entry.bind("<Return>", self.OnPressEnter)

        button = Button(self,text="SPI send", command=self.OnButtonClick)
        button.grid(column=1,row=0)
        
        #ramp = Button(self,text="RAMP", command=self.setlabvar)
        #ramp.grid(column=1,row=1)        

        self.labelVariable = StringVar()
        label = Label(self,textvariable=self.labelVariable,
                              anchor="w",fg="white",bg="blue")
        label.grid(column=0,row=1,columnspan=1,sticky='EW')
        self.labelVariable.set("Start..")
        
        self.slider = Scale(self, from_=0, to=80, orient=HORIZONTAL, 
                            command=self.setlabvar)
        self.slider.grid(column=0, row=2, columnspan=3, sticky='EW')
        
        self.PID = PIDTune(self)
        self.PID.grid(column=0, row=3, columnspan=3, sticky='EW')
        
        self.grid_columnconfigure(0,weight=1)
        self.update()
        #self.geometry(self.geometry()) # caused busy wait?
        self.entry.focus_set()
Пример #28
0
    def body(self, parent):
        """
        Define the custom body of the dialog
        :param parent:          The parent instance of the dialog
        """
        # Define the labels of all of the sub widgets that are to be used
        Label(parent, text="Name:").grid(row=0, column=0, sticky=W)
        Label(parent, text="X-Coord:").grid(row=1, column=0, sticky=W)
        Label(parent, text="Y-Coord:").grid(row=1, column=2, sticky=W)
        Label(parent, text="Mesh:").grid(row=2, column=0, sticky=W)
        Label(parent, text="Scale:").grid(row=3, column=0, sticky=W)
        Label(parent, textvariable=self._scale_text, bg="grey").grid(row=3, column=1, sticky=W)

        #Define the text entry widgets
        self._object_name = Label(parent, text=self._entries["name"])
        self._object_name.grid(column=1, row=0, sticky=W)
        self._x_coord = Label(parent, text=self._entries["x_coordinate"])
        self._x_coord.grid(column=1, row=1, sticky=W)
        self._y_coord = Label(parent, text=self._entries["y_coordinate"])
        self._y_coord.grid(column=3, row=1, stick=W)
        self._mesh = Entry(parent, width=15, text=self._entries["mesh"])
        if self._entries["mesh"] is None:
            self._mesh.insert(0, "No mesh loaded")
        else:
            self._mesh.insert(0, self._entries["mesh"])
        self._mesh.grid(column=1, row=2, columnspan=2, sticky=W)
        Button(parent, text="Load", width=5, command=self._load_mesh, default=ACTIVE).grid(column=3, row=2)

        self._scale = Scale(parent, from_=1, to=100, orient=HORIZONTAL, length=140, variable=self._scale_text, showvalue=0)
        if self._entries["scale"] is not None:
            self._scale.set(self._entries["scale"])
            self._scale_text.set(str(self._entries["scale"]))
        self._scale.grid(row=3, column=2, columnspan=2, sticky=W)
Пример #29
0
 def __init__(self, parent=None):
     Frame.__init__(self, parent)
     self.pack(side=BOTTOM, anchor=S, fill=X)
     self.scale = Scale(self, from_=0, to=1, sliderlength = 10,
             showvalue=YES, tickinterval=10,
             orient='horizontal')
     self.scale.pack(fill=X)
Пример #30
0
class Playbar(Frame):
    def __init__(self, parent=None):
        Frame.__init__(self, parent)
        self.pack(side=BOTTOM, anchor=S, fill=X)
        self.scale = Scale(self, from_=0, to=1, sliderlength = 10,
                showvalue=YES, tickinterval=10,
                orient='horizontal')
        self.scale.pack(fill=X)
        # We don't set the initial value of the scale here because
        # that's done by tying it to the global variable "slidert"

# Resetscale: takes a frame count and resets scale parms appropriately
    def resetscale(self, frames):
        temp = floor(log10(frames))
        tickinterval = int(pow(10,temp))
        if(tickinterval<1): tickinterval = 1
        self.scale.config(to=frames, tickinterval=tickinterval)
Пример #31
0
 def __init__(self, master, name, from_, to, tickinterval, length, orient, command):
     self.s = 3*[None]
     axes = ['X','Y','Z']
     for i in range(3):
         self.s[i] = Scale(master, label=name+' '+axes[i], from_=from_[i], to=to[i], 
             tickinterval=tickinterval[i], orient=orient[i], length=length[i], command=command)
         self.s[i].pack()
     separator = Frame(height=2, bd=1, relief=tk.SUNKEN)
     separator.pack(fill=tk.X, padx=5, pady=5)
Пример #32
0
 def create_controls(self):
     canvas = self.area.get_canvas()
     start = Button(self, text="Start", command=self.start)
     scale = Scale(self,
                   length=250,
                   orient="horizontal",
                   label='Rayon :',
                   troughcolor='dark grey',
                   sliderlength=20,
                   showvalue=0,
                   from_=0,
                   to=100,
                   tickinterval=25,
                   command=self.update_circle)
     scale.set(50)
     canvas.create_window(50, 200, window=start)
     canvas.create_window(250, 200, window=scale)
     return start, scale
Пример #33
0
    def __init__(self, a, frame, view):
        self.view = view
        amin = np.amin(a)
        amax = np.amax(a)

        # Image min and max values
        self.min_var = IntVar(value=amin)
        self.max_var = IntVar(value=amax)

        self.min_label = Label(frame, text="Min.")
        self.max_label = Label(frame, text="Max.")

        self.min_entry = Entry(frame, textvariable=self.min_var)
        self.max_entry = Entry(frame, textvariable=self.max_var)

        self.min_entry.bind(
            "<Return>", lambda event: self.min_entry_change(
                self.min_scale, self.min_var.get()))
        self.max_entry.bind(
            "<Return>", lambda event: self.max_entry_change(
                self.max_scale, self.max_var.get()))

        self.min_scale = Scale(frame,
                               orient=HORIZONTAL,
                               from_=amin,
                               to=amax - 1,
                               length=150,
                               command=self.min_change)
        self.max_scale = Scale(frame,
                               orient=HORIZONTAL,
                               from_=amin + 1,
                               to=amax,
                               length=150,
                               command=self.max_change)

        self.min_scale.set(amin)
        self.max_scale.set(amax)

        self.min_label.grid(row=0, column=0, sticky='w')
        self.max_label.grid(row=1, column=0, sticky='w')
        self.min_entry.grid(row=0, column=1, ipady=2)
        self.max_entry.grid(row=1, column=1, ipady=2)
        self.min_scale.grid(row=0, column=2, sticky='e', padx=10)
        self.max_scale.grid(row=1, column=2, sticky='e', padx=10)
Пример #34
0
class Controller(Observer):
    def __init__(self, parent, subject):
        print("Controller : __init__")
        self.subject = subject
        self.amp = IntVar()
        self.scale_amp = Scale(parent,
                               variable=self.amp,
                               label="Amplitude",
                               orient="horizontal",
                               length=250,
                               from_=0,
                               to=5,
                               relief="sunken",
                               sliderlength=20,
                               tickinterval=1,
                               command=self.update_amplitude)
        self.freq = IntVar()
        self.scale_freq = Scale(parent,
                                variable=self.freq,
                                label="Frequence",
                                orient="horizontal",
                                length=250,
                                from_=0,
                                to=5,
                                relief="sunken",
                                sliderlength=20,
                                tickinterval=1,
                                command=self.update_frequence)

    def update(self, subject):
        pass

    def update_amplitude(self, event):
        print("Controller : update_amplitude", self.amp.get())
        self.subject.set_magnitude(self.amp.get())

    def update_frequence(self, event):
        print("Controller : update_frequence", self.freq.get())
        self.subject.set_frequency(self.freq.get())

    def packing(self):
        self.scale_amp.pack(expand=1, fill="x", padx=6)
        self.scale_freq.pack(expand=1, fill="x", padx=6)
Пример #35
0
    def body(self, parent):
        """
        Overridden method defining the body of the dialog
        :param parent:
        :return:
        """

        # Define all of the labels for our options
        Label(parent, text="Frame Angle:", padx=3, anchor=SW, height=2).grid(row=0, column=0, sticky=W)
        Label(parent, text="Eye Height:", padx=3, anchor=SW, height=2).grid(row=1, column=0, pady=2, sticky=W )
        Label(parent, text="MinDistToWall:", padx=3, anchor=SW, height=2).grid(row=2, column=0, pady=2,  sticky=W)
        Label(parent, text="Distortion:", padx=3).grid(row=3, column=0, pady=2, sticky=W)
        Label(parent, text="Windowed:", padx=3).grid(row=4, column=0, pady=2, sticky=W)

        # Define the sub-widgets that the labels are referring to
        self._frameAngle = Scale(parent, from_=-20, to=20, orient=HORIZONTAL)
        if self._entries["frame_angle"] is not None:
            self._frameAngle.set(self._entries["frame_angle"])
        else:
            self._frameAngle.set(-5)
        self._frameAngle.grid(row=0, column=1, padx=3)

        self._eyeHeight = Scale(parent, from_=0, to=500, orient=HORIZONTAL)
        if self._entries["eye_height"] is not None:
            self._eyeHeight.set( self._entries["eye_height"] )
        else:
            self._eyeHeight.set(50)
        self._eyeHeight.grid(row=1, column=1, padx=3)

        self._minDistToWall = Scale(parent, from_=1, to=300, orient=HORIZONTAL)
        if self._entries["minimum_dist_to_wall"] is not None:
            self._minDistToWall.set( self._entries["minimum_dist_to_wall"] )
        else:
            self._minDistToWall.set(20)
        self._minDistToWall.grid(row=2, column=1, padx=3)

        self._distortion = Checkbutton(parent, variable=self._distortion_var, offvalue=0, onvalue=1, text="Enable", command=self._toggle_distortion)
        self._distortion.grid(row=3, column=1, padx=3)

        self._windowed = Checkbutton(parent, variable=self._win_var, offvalue=0, onvalue=1, text="Enable", command=self._toggle_windowed)
        self._windowed.grid(row=4, column=1, padx=3)
Пример #36
0
    def __init__(self, parent=None):
        """ initialisation

        parent : oscilloscope
        """
        Frame.__init__(self)
        self.configure(bd=1, relief="sunken")
        self.parent = parent
        self.scale = Scale(self, length=300, orient="horizontal",
                label="Temps", showvalue=1, from_=1, to=10,
                tickinterval=1, command=self.update_time_base)
        self.scale.pack(expand="yes", fill="both")
Пример #37
0
    def createOptionsFrame(self,parent):
        self.frame = Frame(parent)

        self.magnitudeY=Scale(self.frame,length=250,orient="horizontal",
                         label="Y Magnitude", sliderlength=20,
                         showvalue=0,from_=0,to=4,
                         tickinterval=1)
        self.frequencyY=Scale(self.frame,length=250,orient="horizontal",
                         label="Y Frequence", sliderlength=20,
                         showvalue=0,from_=0,to=32,
                         tickinterval=6)
        self.phaseY=Scale(self.frame,length=250,orient="horizontal",
                         label="Y Phase", sliderlength=20,
                         showvalue=0,from_=-180,to=180,
                         tickinterval=90)
        self.magnitudeX=Scale(self.frame,length=250,orient="horizontal",
                         label="X Magnitude", sliderlength=20,
                         showvalue=0,from_=0,to=4,
                         tickinterval=1)
        self.frequencyX=Scale(self.frame,length=250,orient="horizontal",
                         label="X Frequence", sliderlength=20,
                         showvalue=0,from_=0,to=32,
                         tickinterval=6)
        self.phaseX=Scale(self.frame,length=250,orient="horizontal",
                         label="X Phase", sliderlength=20,
                         showvalue=0,from_=-180,to=180,
                         tickinterval=90)
Пример #38
0
class Screen(Observer):
    def __init__(self,parent,bg="white"):
        self.canvas=Canvas(parent,bg=bg)
        print("parent",parent.cget("width"),parent.cget("height"))
        self.magnitude=Scale(parent,length=250,orient="horizontal",
                         label="Magnitude", sliderlength=20,
                         showvalue=0,from_=0,to=5,
                         tickinterval=25)
    def update(self,model):
        print("View update")
        signal=model.get_signal()
        self.plot_signal(signal)

    def get_magnitude(self):
        return self.magnitude
        
    def plot_signal(self,signal,color="red"):
        w,h=self.canvas.cget("width"),self.canvas.cget("height")
        width,height=int(w),int(h)
#        print(self.canvas.find_withtag("signal"))
        if self.canvas.find_withtag("signal") :
            self.canvas.delete("signal")
        if signal and len(signal) > 1:
            plot = [(x*width, height/2.0*(y+1)) for (x, y) in signal]
            signal_id = self.canvas.create_line(plot, fill=color, smooth=1, width=3,tags="signal")
        return

    def grid(self, steps):
        w,h=self.canvas.cget("width"),self.canvas.cget("height")
        width,height=int(w),int(h)
        self.canvas.create_line(10,height/2,width,height/2,arrow="last")
        self.canvas.create_line(10,height-5,10,5,arrow="last")
        step=(width-10)/steps*1.
        for t in range(1,steps+2):
            x =t*step
            self.canvas.create_line(x,height/2-4,x,height/2+4)

    def packing(self) :
        self.canvas.pack()
        self.magnitude.pack()
Пример #39
0
    def _load_gui(self):
        root = Tk()
        root.title("Scraper")
        main_frame = Frame(root)
        main_frame.grid(column=0, row=0, sticky=(N, W, E, S))
        main_frame.columnconfigure(0, weight=1)
        main_frame.rowconfigure(0, weight=1)
        main_frame.pack()
        
        self.scale_red_min = Scale(main_frame, from_=0, to=255, orient=HORIZONTAL, command=self._update_red_min)
        self.scale_red_min.grid(column=1, row=1)
       
        self.scale_red_max = Scale(main_frame, from_=0, to=255, orient=HORIZONTAL, command=self._update_red_max)
        self.scale_red_max.grid(column=2, row=1)
        self.scale_red_max.set(255)
        
        self.scale_green_min = Scale(main_frame, from_=0, to=255, orient=HORIZONTAL, command=self._update_green_min)
        self.scale_green_min.grid(column=1, row=2)

        self.scale_green_max = Scale(main_frame, from_=0, to=255, orient=HORIZONTAL, command=self._update_green_max)
        self.scale_green_max.grid(column=2, row=2)
        self.scale_green_max.set(255)

        self.scale_blue_min = Scale(main_frame, from_=0, to=255, orient=HORIZONTAL, command=self._update_blue_min)
        self.scale_blue_min.grid(column=1, row=3)
        
        self.scale_blue_max = Scale(main_frame, from_=0, to=255, orient=HORIZONTAL, command=self._update_blue_max)
        self.scale_blue_max.grid(column=2, row=3)
        self.scale_blue_max.set(255)
        return root
Пример #40
0
    def __init__(self, parent, name="X"):
        """
        Initialisation

        parent : un oscilloscope
        name : nom du signal
        """
        Frame.__init__(self)
        self.configure(bd=1, relief="sunken")
        self.parent = parent
        self.name = name
        self.drawVar = IntVar()
        self.signal = None

        self.draw = Checkbutton(self,
                                text="Afficher " + self.name,
                                selectcolor=eval('self.parent.view.color_' +
                                                 name),
                                variable=self.drawVar,
                                onvalue=1,
                                offvalue=0,
                                command=self.parent.plot_all)
        self.draw.pack()
        self.draw.select()

        self.scale_A = Scale(self,
                             length=100,
                             orient="horizontal",
                             label=name + " Amplitude",
                             showvalue=1,
                             from_=0,
                             to=10,
                             tickinterval=1,
                             command=self.update_signal)
        self.scale_A.pack(expand="yes", fill="both")

        self.scale_F = Scale(self,
                             length=100,
                             orient="horizontal",
                             label=name + " Fréquence",
                             showvalue=1,
                             from_=1,
                             to=10,
                             tickinterval=1,
                             command=self.update_signal)
        self.scale_F.pack(expand="yes", fill="both")

        self.scale_P = Scale(self,
                             length=100,
                             orient="horizontal",
                             label=name + " Phase",
                             showvalue=1,
                             from_=0,
                             to=10,
                             tickinterval=1,
                             command=self.update_signal)
        self.scale_P.pack(expand="yes", fill="both")

        self.bind("<Configure>", self.update_signal)
Пример #41
0
class Playbar(Frame):
    def __init__(self, parent=None):
        Frame.__init__(self, parent)
        self.pack(side=BOTTOM, anchor=S, fill=X)
        self.scale = Scale(self,
                           from_=0,
                           to=1,
                           sliderlength=10,
                           showvalue=YES,
                           tickinterval=10,
                           orient='horizontal')
        self.scale.pack(fill=X)
        # We don't set the initial value of the scale here because
        # that's done by tying it to the global variable "slidert"

# Resetscale: takes a frame count and resets scale parms appropriately

    def resetscale(self, frames):
        temp = floor(log10(frames))
        tickinterval = int(pow(10, temp))
        if (tickinterval < 1): tickinterval = 1
        self.scale.config(to=frames, tickinterval=tickinterval)
Пример #42
0
    def __init__(self, network):
        Tk.__init__(self)
        self.title("DATK")

        self.network = network
        self.n_steps = network.count_snapshots()
        self.network.restore_snapshot(0)
        self.canvas = Canvas(self, width=800, height=500)
        self.canvas.draw(self.network)
        self.canvas.pack()

        self.slider = Scale(self, from_=0, to=self.n_steps-1, length=300,
            orient=HORIZONTAL, command=self.updateValue)
        self.slider.pack(padx=10, pady=10)
Пример #43
0
class Simulator(Tk):
    def __init__(self, network):
        Tk.__init__(self)
        self.title("DATK")

        self.network = network
        self.n_steps = network.count_snapshots()
        self.network.restore_snapshot(0)
        self.canvas = Canvas(self, width=800, height=500)
        self.canvas.draw(self.network)
        self.canvas.pack()

        self.slider = Scale(self, from_=0, to=self.n_steps-1, length=300,
            orient=HORIZONTAL, command=self.updateValue)
        self.slider.pack(padx=10, pady=10)
    
    def updateValue(self, val):
        self.network.restore_snapshot(int(float(val)))
        self.canvas.draw(self.network)
    
    def destroy(self):
        self.network.restore_snapshot(-1)
        Tk.destroy(self)
Пример #44
0
class TimeBase(Frame):
    """
    Base de temps

    scale_time : controle  de la base de temps
    """
    def __init__(self, parent=None):
        """
        Initialisation

        parent : oscilloscope
        """
        Frame.__init__(self)
        self.configure(bd=1, relief="sunken")
        self.parent = parent
        self.scale_time = Scale(self, length=100, orient="horizontal",
                label="Temps", showvalue=1, from_=1, to=10,
                tickinterval=1, command=self.update)
        self.scale_time.pack(expand="yes", fill="both")

        # choix d'afficher lissajoux ou pas
        self.check = Checkbutton(self,text="Afficher lissajou", selectcolor=self.parent.lissajoux.color_XY,  command=self.parent.plot_all, variable=self.parent.drawXY, onvalue = 1, offvalue = 0)
        self.check.pack(side="top",expand="yes", fill="x")
        self.check.select()

    def get_time(self):
        """
        recuperer la valeur courante de la base de temps
        """
        return self.scale_time.get()

    def update(self, event):
        """mise a jour de la base de temps"""
        print("TimeBase.update_time_base()")
        print("Base de temps : ", self.scale_time.get())
        if not isinstance(self.parent, Tk):
            self.parent.update_time(self.scale_time.get())
Пример #45
0
    def __init__(self, parent=None):
        """
        Initialisation

        parent : oscilloscope
        """
        Frame.__init__(self)
        self.configure(bd=1, relief="sunken")
        self.parent = parent
        self.scale_time = Scale(self, length=100, orient="horizontal",
                label="Temps", showvalue=1, from_=1, to=10,
                tickinterval=1, command=self.update)
        self.scale_time.pack(expand="yes", fill="both")

        # choix d'afficher lissajoux ou pas
        self.check = Checkbutton(self,text="Afficher lissajou", selectcolor=self.parent.lissajoux.color_XY,  command=self.parent.plot_all, variable=self.parent.drawXY, onvalue = 1, offvalue = 0)
        self.check.pack(side="top",expand="yes", fill="x")
        self.check.select()
	def __init__(self, parent):
		Frame.__init__(self, parent)
		self.result = 0
		self.master.title("This is a test")
		self.master.minsize(width = 600, height = 800)
		#self.master.


		self.prompt = Label(self, text = "Enter a number:", anchor = "w", fg = "#984301")
		self.entry  = Entry(self, width = 50, highlightcolor = "red")
		self.submit = Button(self, text = "Submit", command = self.calculate)
		self.exit   = Button(self, text = "Exit", command = parent.destroy, fg = "red")
		self.output = Label(self, text = "")
		self.menu   = Menu(self, title = "Menu test", bg = "black")
		self.canvas = Canvas(self, cursor = "circle", highlightcolor = "blue", bg = "#019bf0")

		self.button1 = Button(self, text = "tast antum", bg = "red", fg = "green", command = self.newWindow, \
								activebackground = "red", activeforeground = "blue", relief = "sunken", cursor = "dot")

		self.newFrame = Frame(self, bg = "green", highlightcolor = "blue")
		self.button2 = Button(self.newFrame, text = "This is a tast")
		self.button2.grid()
		self.scale = Scale(self, from_ = 50, to_ = 60, orient = "horizontal", digits = 3, resolution = 0.25, highlightcolor = "red", command = self.calculate)
		self.scale.pack()
		self.open_file_button = Button(self, text = "Open File", command = self.openFile)

		self.prompt.pack(side = "top", fill = "x")
		self.entry.pack(side = "top", fill = "x")
		self.output.pack(side = "top", fill = "x", expand = True)
		self.submit.pack(side = "right")
		self.exit.pack(side = "left")
		self.button1.pack(fill="x")
		self.newFrame.pack(side="bottom", fill = "x", expand = True)
		self.button2.grid()
		self.canvas.pack()
		self.open_file_button.pack()
		#self.slider.pack()

		#self.tk = Tkinter.Tk()
		#self.tk.withdrow()
		#self.file_path = Tkinter.filedialog.askopenfilename()
		#print("test")
		self.entry.insert(string = "3", index = 0)
Пример #47
0
 def draw_game_info_grid(self):
     '''
     Draw control and inform part of game to right side of the window.
     '''
     self.info = Canvas(self.root, height=self.h - self.gridh, width=self.w - self.gridw)
     self.info.pack(side="left")
     
     label_stones = Label(self.info, text="Current stones:", font=("Helvetica", 10))
     label_stones.grid(row=1, column=0)
     label_max_time = Label(self.info, text="Max time:", font=("Helvetica", 10))
     label_max_time.grid(row=2, column=0)
     
     label_scale = Label(self.info, text='Game speed [ms]:', font=("Helvetica", 10), foreground='black')
     label_scale.grid(row=5, column=0)
   
     helv36 = font.Font(family="helvetica", size=16, weight='bold')
     self.scale_var = IntVar()
     scale = Scale(self.info, variable=self.scale_var, command=self.sleep_time_change_handler, from_=0, to=1000, resolution=10, width="15", orient=HORIZONTAL, length="225")
     scale.set(200)
     scale.grid(row=5, column=1, columnspan=3)
     
     self.button = Button(self.info, text="Play", width="20", height="2", command=self.play_button_click_handler)
     self.button['font'] = helv36
     self.button.grid(row=6, column=0, columnspan=4)
     
     # labels for num stones, max time of move, etc
     self.label_player_stones = [-1, -1]
     self.label_player_max_time = [-1, -1]
     self.labels_inform = [-1, -1]
     self.labels_player_name = [-1, -1]
     self.option_menus = [-1, -1]
     self.option_menus_vars = [-1, -1]
     
     for i in range(2):
         self.label_player_stones[i] = Label(self.info, text='2', font=("Helvetica", 10), foreground=self.colors[i])
         self.label_player_stones[i].grid(row=1, column=2 * (i + 1) - 1, columnspan=2)
     
         self.label_player_max_time[i] = Label(self.info, text="%.2f [ms]" % 0.0, font=("Helvetica", 10), foreground=self.colors[i])
         self.label_player_max_time[i].grid(row=2, column=2 * (i + 1) - 1, columnspan=2)
     
         self.labels_inform[i] = Label(self.info, text='', font=("Helvetica", 10), foreground='black')
         self.labels_inform[i].grid(row=i + 3, column=0, columnspan=4)  
     
         self.labels_player_name[i] = Label(self.info, text="Player%d:" % (i), font=("Helvetica", 12), foreground=self.colors[i])
         self.labels_player_name[i].grid(row=0, column=2 * i)    
         
         self.option_menus_vars[i] = StringVar(self.root)
         self.option_menus_vars[i].set(self.interractivePlayerName)
         self.option_menus[i] = OptionMenu(self.info, self.option_menus_vars[i], *self.possiblePlayers)
         self.option_menus[i].grid(row=0, column=2 * i + 1)
Пример #48
0
    def initialize(self):
        self.grid()
        self.entryVariable = StringVar()
        self.entry = Entry(self, textvariable=self.entryVariable)
        self.entry.grid(column=0,row=0,sticky='EW')
        self.entry.bind("<Return>", self.OnPressEnter)

        button = Button(self,text="Set Steering", command=self.OnButtonClick)
        button.grid(column=1,row=0)

        self.labelVariable = StringVar()
        label = Label(self,textvariable=self.labelVariable,
                              anchor="w",fg="white",bg="green")
        label.grid(column=0,row=1,columnspan=1,sticky='EW')
        self.labelVariable.set("Start..")

        left = Button(self,text="Left", command=self.Left)
        left.grid(column=0,row=2)

        right = Button(self,text="Right", command=self.Right)
        right.grid(column=1,row=2)

        centre = Button(self,text="Centre", command=self.Centre)
        centre.grid(column=3,row=2)

        self.steerVariable = StringVar()
        steerState = Label(self,textvariable=self.steerVariable,
                           anchor="w",fg="white",bg="green")
        steerState.grid(column=0,row=3,columnspan=1,sticky='EW')
        self.steerVariable.set("Start..")
        
        self.turn_angle = steering.GetTurnAngle();
        
        self.slider = Scale(self, from_=-self.turn_angle, to=self.turn_angle, 
                            orient=HORIZONTAL, command=self.setSteerState)
        self.slider.grid(column=0, row=4, columnspan=3, sticky='EW')        

        self.grid_columnconfigure(0,weight=1)
        self.update()
        #self.geometry(self.geometry()) # caused busy wait?
        self.entry.focus_set()
Пример #49
0
 def create_scale(self, region):
     """ Create scale for this parameter"""
     if self._is_int:
         resolution = 1
     else:
         resolution = 0.001
     frame = Frame(region)
     label = Label(frame, text=self._label)
     label.pack()
     scale = Scale(frame,
                   from_=self._top,
                   to=self._bottom,
                   command=self.update_value,
                   resolution=resolution)
     scale.set(self._value)
     scale.pack()
     frame.pack(side=LEFT)
Пример #50
0
def FDL(k,fName):
    """Infitie loop function which constantly runs the display given
    the file name of the sequences and an initial k"""

    global kInput
    #Gets the initial de Bruijn Graph
    fdlNodes,minSeqLen = getFDLNodes(k,fName)  
    #Sets up kInput to the appriate scale (3 to the shortest length - 1 ) to ensure
    #   all sequence reads are always included
    if not kInput:
        minSeqLen -= 1 
        kInput = Scale(root, from_=3, to=minSeqLen,orient=HORIZONTAL,label="K",relief = FLAT)
        kInput.set(k) #sets the initial k value
        kInput.pack(side=LEFT, padx=50, pady=10)

    #generates all lines from the initial graph    
    lines = addLines(fdlNodes)
    #starts inifinite recursive loop for redraw function
    move_nodes(fdlNodes, kInput.get(), kInput.get(), lines, root,fName)
    #starts display
    root.mainloop()
Пример #51
0
    def createWidgets(self):
        self.controlFrame=Frame(self)
        self.posScale = Scale(self.controlFrame, orient='horizontal',
                           length=210,
                           from_=0, tickinterval=0,
                           command=self.pos_callback,
                           showvalue=0,sliderlength=10, resolution=1)
        #self.posScale.bind('<Button-1>',self.pos_start_drag)
        #self.posScale.bind('<ButtonRelease-1>', self.pos_set)

        self.playB=Button(self.controlFrame, text="play", command=self.playToggle)
        self.nextB=Button(self.controlFrame, text="next", command=self.nextRun)
        self.prevB=Button(self.controlFrame, text="prev", command=self.prevRun)
        self.camera=tkimg(self, width=640, height=512)
        self.controlFrame.grid(row=0,column=1, sticky="nw")
        self.view.grid(row=1, column=1, sticky="nsew")
        self.grid_columnconfigure(1,weight=1)
        self.grid_rowconfigure(1,weight=1)
        self.camera.grid(row = 1, column = 2, sticky = 'ne')
        self.playB.grid(row=0, column=1)
        self.prevB.grid(row=0, column=2)
        self.nextB.grid(row=0, column=3)
        self.posScale.grid(row=0, column=0)
Пример #52
0
    def __init__(self, parent, name="X"):
        """
        Initialisation

        parent : un oscilloscope
        name : nom du signal
        """
        Frame.__init__(self)
        self.configure(bd=1, relief="sunken")
        self.parent = parent
        self.name = name
        self.scale_A = Scale(self,
                             length=100,
                             orient="horizontal",
                             label=name + " Amplitude",
                             showvalue=1,
                             from_=0,
                             to=10,
                             tickinterval=1,
                             command=self.update_signal)

        self.scale_F = Scale(self,
                             length=100,
                             orient="horizontal",
                             label=name + " Fréquence",
                             showvalue=1,
                             from_=0,
                             to=10,
                             tickinterval=1,
                             command=self.update_signal)

        self.scale_P = Scale(self,
                             length=100,
                             orient="horizontal",
                             label=name + " Phase",
                             showvalue=1,
                             from_=0,
                             to=5,
                             tickinterval=1,
                             command=self.update_signal)

        self.scale_F.pack(expand="yes", fill="both")
        self.scale_A.pack(expand="yes", fill="both")
        self.scale_P.pack(expand="yes", fill="both")
Пример #53
0
    def __init__(self, parent, bg="white"):
        self.canvas = Canvas(parent, bg=bg)
        self.canvas.bind("<Configure>", self.resize)
        self.width = int(self.canvas.cget("width"))
        self.height = int(self.canvas.cget("height"))

        print("parent", parent.cget("width"), parent.cget("height"))

        self.magnitude = Scale(parent,
                               length=250,
                               orient="horizontal",
                               label="Magnitude",
                               sliderlength=20,
                               showvalue=0,
                               from_=0,
                               to=10,
                               tickinterval=1,
                               relief="sunken")

        self.frequency = Scale(parent,
                               length=250,
                               orient="horizontal",
                               label="Frequency",
                               sliderlength=20,
                               showvalue=0,
                               from_=0,
                               to=10,
                               tickinterval=1,
                               relief="sunken")

        self.phase = Scale(parent,
                           length=250,
                           orient="horizontal",
                           label="Phase",
                           sliderlength=20,
                           showvalue=0,
                           from_=0,
                           to=10,
                           tickinterval=1,
                           relief="sunken")
Пример #54
0
    def create_sliders(self, master=None):
        """Create the Color Sliders."""
        self.hue_scale = Scale(self.hue_group, orient="horizontal",
                               showvalue="false", variable=self.hue)
        self.hue_scale["from"] = 0
        self.hue_scale["to"] = 360
        self.hue_scale.pack(side=LEFT)

        self.saturation_scale = Scale(self.saturation_group,
                                      orient="horizontal",
                                      showvalue="false",
                                      variable=self.saturation)
        self.saturation_scale["from"] = 0
        self.saturation_scale["to"] = 100
        self.saturation_scale.pack(side=LEFT)

        self.value_scale = Scale(self.value_group, orient="horizontal",
                                 showvalue="false", variable=self.value)
        self.value_scale["from"] = 0
        self.value_scale["to"] = 100
        self.value_scale.pack(side=LEFT)

        self.red_scale = Scale(self.red_group, orient="horizontal",
                               showvalue="false", variable=self.red)
        self.red_scale["from"] = 0
        self.red_scale["to"] = 255
        self.red_scale.pack(side=LEFT)

        self.green_scale = Scale(self.green_group, orient="horizontal",
                                 showvalue="false", variable=self.green)
        self.green_scale["from"] = 0
        self.green_scale["to"] = 255
        self.green_scale.pack(side=LEFT)

        self.blue_scale = Scale(self.blue_group, orient="horizontal",
                                showvalue="false", variable=self.blue)
        self.blue_scale["from"] = 0
        self.blue_scale["to"] = 255
        self.blue_scale.pack(side=LEFT)
Пример #55
0
    def __init__(self, master):
        super(GUI, self).__init__(master)
        row1, row2, row3, row4 = self.set_rows(4)
        desc = Label(row1,
                     text="Unify Walk Lengths by mean-Binning the Time Series")
        desc.pack(fill=tk.X, ipadx=10, ipady=10, side=tk.TOP)
        dirbutton = Button(row1, text="Select Folder", command=self.define_dir)
        dirbutton.pack(side=tk.LEFT, expand=True)
        o = Label(row1, text="or")
        o.pack(side=tk.LEFT, padx=20, expand=True)
        filebutton = Button(row1,
                            text="Select Specific File",
                            command=self.define_file)
        filebutton.pack(side=tk.LEFT, expand=True)

        self.show_chosen = Label(row2,
                                 textvariable=self.chosen,
                                 background='white')
        self.show_chosen.pack(fill=tk.X,
                              side=tk.LEFT,
                              pady=10,
                              ipady=5,
                              ipadx=5,
                              expand=True)

        nb = Label(row3, text="Number of Bins:", pady=10)
        nb.pack(side=tk.LEFT)

        scale = Scale(row3, from_=0, to=150, orient=tk.HORIZONTAL)
        scale.set(100)
        scale.pack(side=tk.LEFT, fill=tk.X, expand=True)
        self.scale = scale

        row4.pack(fill=tk.NONE)
        self.go_button = Button(row4, text="GO")
        self.go_button.pack(side=tk.LEFT, padx=10)

        self.close_button = Button(row4, text="Close", command=master.destroy)
        self.close_button.pack(side=tk.RIGHT, padx=10)
Пример #56
0
from Tkinter import Tk,Scale,IntVar,DoubleVar

def update_magnitude(event):
    global data
    x=int(event.widget.get())   
    print(x,type(x))
    print(data.get(),data.get())

if __name__ == "__main__" :
    root = Tk()
    root.title("Oscilloscope v.1")
    data=DoubleVar()
    magnitude=Scale(root,variable=data,
                    length=250,orient="horizontal",
                    label="Magnitude",sliderlength=20,
                    showvalue=0,from_=0,to=5,tickinterval=25)
    magnitude.pack()
    magnitude.bind("<B2-Motion>",update_magnitude)
    root.mainloop()

def sunfounder_client(ip, key):
        #!/usr/bin/env python
        # -*- coding: utf-8 -*-
        from Tkinter import Tk, Button, Label, Scale, HORIZONTAL

        print "Connecting to IP", ip

        ctrl_cmd = ['forward', 'backward', 'left', 'right', 'stop', 'read cpu_temp', 'home', 'distance', 'x+', 'x-', 'y+', 'y-', 'xy_home']

        top = Tk()   # Create a top window
        top.title('Sunfounder Raspberry Pi Smart Video Car')

        HOST = ip    # Server(Raspberry Pi) IP address
        PORT = 21567
        BUFSIZ = 1024             # buffer size
        ADDR = (HOST, PORT)

        tcpCliSock = socket(AF_INET, SOCK_STREAM)   # Create a socket
        tcpCliSock.connect(ADDR)                    # Connect with the server
        # =============================================================================
        # The function is to send the command forward to the server, so as to make the 
        # car move forward.
        # ============================================================================= 
        def forward_fun(event):
                print "\nUser command = forward"
                print "Encrypted command = ",crypto.AES_encrypt('forward',key)[2]
                tcpCliSock.send(str(crypto.AES_encrypt('forward',key)))

        def backward_fun(event):
                print '\nUser command = backward'
                print "Encrypted command = ",crypto.AES_encrypt('backward',key)[2]
                tcpCliSock.send(str(crypto.AES_encrypt('backward',key)))

        def left_fun(event):
                print '\nUser command = left'
                print "Encrypted command = ",crypto.AES_encrypt('left',key)[2]
                tcpCliSock.send(str(crypto.AES_encrypt('left',key)))

        def right_fun(event):
                print '\nUser command = right'
                print "Encrypted command = ",crypto.AES_encrypt('right',key)[2]
                tcpCliSock.send(str(crypto.AES_encrypt('right',key)))

        def stop_fun(event):
                print '\nUser command = stop'
                print "Encrypted command = ",crypto.AES_encrypt('stop',key)[2]
                tcpCliSock.send(str(crypto.AES_encrypt('stop',key)))

        def home_fun(event):
                print '\nUser command = home'
                print "Encrypted command = ",crypto.AES_encrypt('home',key)[2]
                tcpCliSock.send(str(crypto.AES_encrypt('home',key)))

        def x_increase(event):
                print '\nUser command = x+'
                print "Encrypted command = ",crypto.AES_encrypt('x+',key)[2]
                tcpCliSock.send(str(crypto.AES_encrypt('x+',key)))

        def x_decrease(event):
                print '\nUser command = x-'
                print "Encrypted command = ",crypto.AES_encrypt('x-',key)[2]
                tcpCliSock.send(str(crypto.AES_encrypt('x-',key)))

        def y_increase(event):
                print '\nUser command = y+'
                print "Encrypted command = ",crypto.AES_encrypt('y+',key)[2]
                tcpCliSock.send(str(crypto.AES_encrypt('y+',key)))

        def y_decrease(event):
                print '\nUser command = y-'
                print "Encrypted command = ",crypto.AES_encrypt('y-',key)[2]
                tcpCliSock.send(str(crypto.AES_encrypt('y-',key)))

        def xy_home(event):
                print '\nUser command = xy_home'
                print "Encrypted command = ",crypto.AES_encrypt('xy_home',key)[2]
                tcpCliSock.send(str(crypto.AES_encrypt('xy_home',key)))

        # =============================================================================
        # Exit the GUI program and close the network connection between the client 
        # and server.
        # =============================================================================
        def quit_fun(event):
                print "\nShutting down program..."
                top.quit()
                tcpCliSock.send(str(crypto.AES_encrypt('stop',key)))
                tcpCliSock.close()

        # =============================================================================
        # Create buttons
        # =============================================================================
        Btn0 = Button(top, width=5, text='Forward')
        Btn1 = Button(top, width=5, text='Backward')
        Btn2 = Button(top, width=5, text='Left')
        Btn3 = Button(top, width=5, text='Right')
        Btn4 = Button(top, width=5, text='Quit')
        Btn5 = Button(top, width=5, height=2, text='Home')

        # =============================================================================
        # Buttons layout
        # =============================================================================
        Btn0.grid(row=0,column=1)
        Btn1.grid(row=2,column=1)
        Btn2.grid(row=1,column=0)
        Btn3.grid(row=1,column=2)
        Btn4.grid(row=3,column=2)
        Btn5.grid(row=1,column=1)

        # =============================================================================
        # Bind the buttons with the corresponding callback function.
        # =============================================================================
        Btn0.bind('<ButtonPress-1>', forward_fun)  # When button0 is pressed down, call the function forward_fun().
        Btn1.bind('<ButtonPress-1>', backward_fun)
        Btn2.bind('<ButtonPress-1>', left_fun)
        Btn3.bind('<ButtonPress-1>', right_fun)
        Btn0.bind('<ButtonRelease-1>', stop_fun)   # When button0 is released, call the function stop_fun().
        Btn1.bind('<ButtonRelease-1>', stop_fun)
        Btn2.bind('<ButtonRelease-1>', stop_fun)
        Btn3.bind('<ButtonRelease-1>', stop_fun)
        Btn4.bind('<ButtonRelease-1>', quit_fun)
        Btn5.bind('<ButtonRelease-1>', home_fun)

        # =============================================================================
        # Create buttons
        # =============================================================================
        Btn07 = Button(top, width=5, text='X+', bg='red')
        Btn08 = Button(top, width=5, text='X-', bg='red')
        Btn09 = Button(top, width=5, text='Y-', bg='red')
        Btn10 = Button(top, width=5, text='Y+', bg='red')
        Btn11 = Button(top, width=5, height=2, text='HOME', bg='red')

        # =============================================================================
        # Buttons layout
        # =============================================================================
        Btn07.grid(row=1,column=5)
        Btn08.grid(row=1,column=3)
        Btn09.grid(row=2,column=4)
        Btn10.grid(row=0,column=4)
        Btn11.grid(row=1,column=4)

        # =============================================================================
        # Bind button events
        # =============================================================================
        Btn07.bind('<ButtonPress-1>', x_increase)
        Btn08.bind('<ButtonPress-1>', x_decrease)
        Btn09.bind('<ButtonPress-1>', y_decrease)
        Btn10.bind('<ButtonPress-1>', y_increase)
        Btn11.bind('<ButtonPress-1>', xy_home)
        #Btn07.bind('<ButtonRelease-1>', home_fun)
        #Btn08.bind('<ButtonRelease-1>', home_fun)
        #Btn09.bind('<ButtonRelease-1>', home_fun)
        #Btn10.bind('<ButtonRelease-1>', home_fun)
        #Btn11.bind('<ButtonRelease-1>', home_fun)

        # =============================================================================
        # Bind buttons on the keyboard with the corresponding callback function to 
        # control the car remotely with the keyboard.
        # =============================================================================
        top.bind('<KeyPress-a>', left_fun)   # Press down key 'A' on the keyboard and the car will turn left.
        top.bind('<KeyPress-d>', right_fun) 
        top.bind('<KeyPress-s>', backward_fun)
        top.bind('<KeyPress-w>', forward_fun)
        top.bind('<KeyPress-h>', home_fun)
        top.bind('<KeyRelease-a>', home_fun) # Release key 'A' and the car will turn back.
        top.bind('<KeyRelease-d>', home_fun)
        top.bind('<KeyRelease-s>', stop_fun)
        top.bind('<KeyRelease-w>', stop_fun)

        spd = 50

        def changeSpeed(ev=None):
                tmp = 'speed'
                global spd
                spd = speed.get()
                data = tmp + str(spd)  # Change the integers into strings and combine them with the string 'speed'.  
                #print 'sendData = %s' % data
                print '\nUser command = ', data
                print "Encrypted command = ",crypto.AES_encrypt(data,key)[2]

                tcpCliSock.send(str(crypto.AES_encrypt(data,key)))  # Send the speed data to the server(Raspberry Pi)

        label = Label(top, text='Speed:', fg='red')  # Create a label
        label.grid(row=6, column=0)                  # Label layout

        speed = Scale(top, from_=0, to=100, orient=HORIZONTAL, command=changeSpeed)  # Create a scale
        speed.set(50)
        speed.grid(row=6, column=1)

        def main():
                top.mainloop()

        if __name__ == '__main__':
                main()
Пример #58
0
    def addPage(self, name):
        page = ttk.Frame(self.panelControl)
        self.panelControl.add(page, text='signal ' + name)

        visible_checkbox = Checkbutton(page, text="Afficher")
        magnitude = Scale(page,
                          length=250,
                          orient="horizontal",
                          label="Amplitude",
                          sliderlength=20,
                          showvalue=0,
                          from_=0,
                          to=5,
                          tickinterval=1,
                          name="magnitudeScale")
        frequency = Scale(page,
                          length=250,
                          orient="horizontal",
                          label="Frequency",
                          sliderlength=20,
                          showvalue=0,
                          from_=0,
                          to=25,
                          tickinterval=5,
                          name="frequencyScale")
        phase = Scale(page,
                      length=250,
                      orient="horizontal",
                      label="Phase",
                      sliderlength=20,
                      showvalue=0,
                      from_=0,
                      to=20,
                      tickinterval=5,
                      name="phaseScale")
        visible_checkbox.pack(fill="x", pady=6)
        magnitude.pack(expand=1, fill="both", pady=6)
        frequency.pack(expand=1, fill="both", pady=6)
        phase.pack(expand=1, fill="both", pady=6)
        self.panel_control_page.append({
            'visible': visible_checkbox,
            'magnitude': magnitude,
            'frequency': frequency,
            'phase': phase
        })
Пример #59
0
    def openCmdWindow(self):
        """
        open the cmd window and initial all the button and text
        """
        panel = Toplevel(self.root)
        panel.wm_title("Command Panel")

        # create text input entry
        text0 = tki.Label(
            panel,
            text=
            'This Controller map keyboard inputs to Tello control commands\n'
            'Adjust the trackbar to reset distance and degree parameter',
            font='Helvetica 10 bold')
        text0.pack(side='top')

        text1 = tki.Label(
            panel,
            text='W - Move Tello Up\t\t\tArrow Up - Move Tello Forward\n'
            'S - Move Tello Down\t\t\tArrow Down - Move Tello Backward\n'
            'A - Rotate Tello Counter-Clockwise\tArrow Left - Move Tello Left\n'
            'D - Rotate Tello Clockwise\t\tArrow Right - Move Tello Right',
            justify="left")
        text1.pack(side="top")

        self.btn_landing = tki.Button(panel,
                                      text="Land",
                                      relief="raised",
                                      command=self.telloLanding)
        self.btn_landing.pack(side="bottom",
                              fill="both",
                              expand="yes",
                              padx=10,
                              pady=5)

        self.btn_takeoff = tki.Button(panel,
                                      text="Takeoff",
                                      relief="raised",
                                      command=self.telloTakeOff)
        self.btn_takeoff.pack(side="bottom",
                              fill="both",
                              expand="yes",
                              padx=10,
                              pady=5)

        # binding arrow keys to drone control
        self.tmp_f = tki.Frame(panel, width=100, height=2)
        self.tmp_f.bind('<KeyPress-w>', self.on_keypress_w)
        self.tmp_f.bind('<KeyPress-s>', self.on_keypress_s)
        self.tmp_f.bind('<KeyPress-a>', self.on_keypress_a)
        self.tmp_f.bind('<KeyPress-d>', self.on_keypress_d)
        self.tmp_f.bind('<KeyPress-Up>', self.on_keypress_up)
        self.tmp_f.bind('<KeyPress-Down>', self.on_keypress_down)
        self.tmp_f.bind('<KeyPress-Left>', self.on_keypress_left)
        self.tmp_f.bind('<KeyPress-Right>', self.on_keypress_right)
        self.tmp_f.pack(side="bottom")
        self.tmp_f.focus_set()

        self.btn_landing = tki.Button(panel,
                                      text="Flip",
                                      relief="raised",
                                      command=self.openFlipWindow)
        self.btn_landing.pack(side="bottom",
                              fill="both",
                              expand="yes",
                              padx=10,
                              pady=5)

        self.distance_bar = Scale(panel,
                                  from_=0.02,
                                  to=5,
                                  tickinterval=0.01,
                                  digits=3,
                                  label='Distance(m)',
                                  resolution=0.01)
        self.distance_bar.set(0.2)
        self.distance_bar.pack(side="left")

        self.btn_distance = tki.Button(
            panel,
            text="Reset Distance",
            relief="raised",
            command=self.updateDistancebar,
        )
        self.btn_distance.pack(side="left",
                               fill="both",
                               expand="yes",
                               padx=10,
                               pady=5)

        self.degree_bar = Scale(panel,
                                from_=1,
                                to=360,
                                tickinterval=10,
                                label='Degree')
        self.degree_bar.set(30)
        self.degree_bar.pack(side="right")

        self.btn_distance = tki.Button(
            panel,
            text="Reset Degreejustin bieber love yourself",
            relief="raised",
            command=self.updateDegreebar)
        self.btn_distance.pack(side="right",
                               fill="both",
                               expand="yes",
                               padx=10,
                               pady=5)
        return quotes
        
    # column vector
    def getVariances(self, profits):
        variances = numpy.zeros(shape=(len(self.companies),1)) 
        for i,company in enumerate(self.companies):
            variances[i,:] = self.companies[company].getVariance()
        
        return variances


if __name__ == "__main__":
    root = Tk.Tk()
    portfolioManager = PortfolioManager()
    scale = Scale(root, from_=0.0, to=1.0, resolution=.01, orient=Tk.HORIZONTAL)
    scale.pack(side=Tk.BOTTOM, expand=1, fill=Tk.BOTH)
    
    '''
    companies = { "EXAS", "BBRY", "CYTK", "ISIS", "NPSP"}#, "AAPL", "PG", "COKE" }
    portfolioManager.addPortfolio(companies)
    '''
    
    companies = { "AMZN", "GE", "AAPL", "PG", "COKE" }
    portfolioManager.addPortfolio(companies)
    

    companies = { "GOOG", "MSFT", "IRBT", "IBM", "WMT" }
    portfolioManager.addPortfolio(companies)