Exemple #1
0
class MainFrame(Frame):    
    def __init__(self, parent):
        Frame.__init__(self, parent)   
        self.parent = parent
        self.initUI()    
              
    def initUI(self):
        self.parent.title("GSN Control Panel")
        self.style = Style()
        self.style.theme_use("default")
        self.pack(fill=BOTH, expand=1)

        self.turnOnBtn = Button(self, text="Turn On")
        self.turnOnBtn["command"] = self.turnOn 
        self.turnOnBtn.grid(row=0, column=0)    
        
        self.turnOffBtn = Button(self, text="Turn Off")
        self.turnOffBtn["command"] = self.turnOff 
        self.turnOffBtn.grid(row=0, column=1)   
    
    def turnOn(self):
        host.enqueue({"SM":"GSN_SM", "action":"turnOn", "gsnId":GSNID, "localIP":IP, "localPort":int(PORT)})
        
    def turnOff(self):
        host.enqueue({"SM":"GSN_SM", "action":"turnOff"})
Exemple #2
0
class ticketWindow(Frame):
    def __init__(self, parent):
        Frame.__init__(self, parent)
        self.parent = parent
        self.parent.title("Zendesk Views")
        self.style = Style()
        self.style.theme_use("default")
        self.style.configure("TFrame", background="#333")
        self.style.configure("TLabel", backgroun="#444")
        self.pack(fill=BOTH, expand=1)
        self.centerWindow()
        ticket1 = ticketViews(parent, 26887076)
        ticket2 = ticketViews(parent, 35868228)

    def centerWindow(self):
        w = 250
        h = 100

        sw = self.parent.winfo_screenwidth()
        sh = self.parent.winfo_screenheight()
        
        x = (sw) /2
        y = (sh) /2
        self.parent.geometry('%dx%d+%d+%d' % (w, h ,x ,y))

    def createQuit(self):
        quitButton = Button(self, text="Quit", command=self.quit)
        quitButton.place(x=50, y=50)
Exemple #3
0
class Example(Frame):

    def __init__(self, parent):
        Frame.__init__(self, parent)

        self.parent = parent
        self.initUI()

    def initUI(self):

        self.parent.title("Message boxes")
        self.style = Style()
        self.style.theme_use("default")
        self.pack()

        error = Button(self, text="Error", command=self.onError)
        error.grid()
        warning = Button(self, text="Warning", command=self.onWarn)
        warning.grid(row=1, column=0)
        question = Button(self, text="Question", command=self.onQuest)
        question.grid(row=0, column=1)
        inform = Button(self, text="Information", command=self.onInfo)
        inform.grid(row=1, column=1)

    def onError(self):
        box.showerror("Error", "Could not open file")

    def onWarn(self):
        box.showwarning("Warning", "Deprecated function call")

    def onQuest(self):
        box.askquestion("Question", "Are you sure to quit?")

    def onInfo(self):
        box.showinfo("Information", "Download completed")
Exemple #4
0
class ticketWindow(Frame):
    def __init__(self, parent):
        Frame.__init__(self, parent)
        self.parent = parent
        self.parent.title("Zendesk Views")
        self.style = Style()
        self.style.theme_use("default")
        self.style.configure("TFrame", background="#333")
        self.style.configure("TLabel", backgroun="#444")
        self.pack(fill=BOTH, expand=1)
        self.centerWindow()
        ticket1 = ticketViews(parent, 26887076)
        ticket2 = ticketViews(parent, 35868228)

    def centerWindow(self):
        w = 250
        h = 100

        sw = self.parent.winfo_screenwidth()
        sh = self.parent.winfo_screenheight()

        x = (sw) / 2
        y = (sh) / 2
        self.parent.geometry('%dx%d+%d+%d' % (w, h, x, y))

    def createQuit(self):
        quitButton = Button(self, text="Quit", command=self.quit)
        quitButton.place(x=50, y=50)
Exemple #5
0
class Example(Frame):
    def __init__(self, parent):
        Frame.__init__(self, parent)

        self.parent = parent
        self.initUI()

    def initUI(self):

        self.parent.title("Message boxes")
        self.style = Style()
        self.style.theme_use("default")
        self.pack()

        error = Button(self, text="Error", command=self.onError)
        error.grid()
        warning = Button(self, text="Warning", command=self.onWarn)
        warning.grid(row=1, column=0)
        question = Button(self, text="Question", command=self.onQuest)
        question.grid(row=0, column=1)
        inform = Button(self, text="Information", command=self.onInfo)
        inform.grid(row=1, column=1)

    def onError(self):
        box.showerror("Error", "Could not open file")

    def onWarn(self):
        box.showwarning("Warning", "Deprecated function call")

    def onQuest(self):
        box.askquestion("Question", "Are you sure to quit?")

    def onInfo(self):
        box.showinfo("Information", "Download completed")
Exemple #6
0
class Example(Frame):
  
    def __init__(self, parent):
        Frame.__init__(self, parent)   
         
        self.parent = parent        
        self.initUI()
        
        
    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)
        

    def onScale(self, val):

        v = int(float(val))
        self.var.set(v)
Exemple #7
0
class myApp(Frame):
  
    def __init__(self, parent):
        Frame.__init__(self, parent, background="white")
        self.parent = parent
        self.initUI()
    
    def initUI(self):
        w = self.parent.winfo_screenwidth()/2
        h = self.parent.winfo_screenheight()/2

        sw = self.parent.winfo_screenwidth()
        sh = self.parent.winfo_screenheight()

        x = (sw - w)/2
        y = (sh - h)/2

        self.parent.geometry('%dx%d+%d+%d' % (w, h, x, y))

        self.parent.title("myApp")
        self.style = Style()
        self.style.theme_use("default")

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

        quitButton = Button(self, text="Quit",
            command=self.quit)
        quitButton.place(x=w/2, y=h/2)
Exemple #8
0
class Example(Frame):

    def __init__(self, parent):
        Frame.__init__(self, parent)
        self.parent = parent
        self.quote = "I was supposed to be a cool quote . But then internet abandoned me !"
        self.author = "Aditya"
        self.project = [{"name":"Portfolio","location": "F:\git\portfolio","command": "http://localhost:8080"},{"name":"JStack","location":"F:\git\JStack" ,"command": "http://localhost:8080"},{"name":"GPS_Track","location": "F:\git\GPS_Track","command": "http://localhost:8080"}]
        self.getQuote()

    def initUI(self):

        self.parent.title("Buttons")
        self.style = Style()
        self.style.theme_use("alt")

        # Styling
        self.style.configure('.', font=('Helvetica', 12), background="#300A24")
        self.style.configure(
            "PW.TLabel", foreground="#fff", background="#300A24", padding=20, justify=CENTER, wraplength="350")
        self.style.configure(
            "Medium.TButton", foreground="#300A24", background="#fff", borderwidth=0, padding=8, font=('Helvetica', 9))
        # Styling Ends

        quoteLabel = Label(self, text=self.quote, style="PW.TLabel")
        quoteLabel.pack()
        authorLabel = Label(self, text=self.author, style="PW.TLabel")
        authorLabel.pack()

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

        closeButton = Button(self, text="Close This",
                             style="Medium.TButton", command=self.parent.quit)
        closeButton.pack(side=RIGHT)
        projectButton = Button(self, text=self.project[0]["name"],
                          style="Medium.TButton", command=lambda: self.btnFn(0))
        projectButton.pack(side=RIGHT)
        projectButton = Button(self, text=self.project[1]["name"],
                          style="Medium.TButton", command=lambda: self.btnFn(1))
        projectButton.pack(side=RIGHT)
        projectButton = Button(self, text=self.project[2]["name"],
                          style="Medium.TButton", command=lambda: self.btnFn(2))
        projectButton.pack(side=RIGHT)

    def getQuote(self):
        # j = json.loads(requests.get(
            # "http://quotes.stormconsultancy.co.uk/random.json").text)
        # self.quote = j["quote"]
        # self.author = j["author"]
        self.initUI()

    def btnFn(self,index):
        subprocess.Popen(
            ['explorer', self.project[index]["location"]])
        subprocess.Popen(
            ['subl', self.project[index]["location"]])
        subprocess.Popen(
            ['console'], cwd=self.project[index]["location"])
        subprocess.Popen(
            ['chrome', self.project[index]["command"]])
Exemple #9
0
class KnnFrame(Frame):
    def __init__(self, parent):
        Frame.__init__(self, parent, background="white")
        self.parent = parent
        self.style = Style()
        self.init_ui()

    def center_window(self):
        width_knn = 500
        height_knn = 500

        sw = self.parent.winfo_screenwidth()
        sh = self.parent.winfo_screenheight()

        x = (sw-width_knn)/2
        y = (sh-height_knn)/2

        self.parent.geometry('%dx%d+%d+%d' % (width_knn, height_knn, x, y))

    def init_ui(self):
        self.parent.title("knn - Classification")
        self.style.theme_use("default")

        self.pack(fill=BOTH, expand=1)
        self.center_window()
        quit_button = Button(self, text="Close", command=self.quit)
        quit_button.place(x=50, y=50)
Exemple #10
0
class Example(Frame):
  
    def __init__(self, parent):
        Frame.__init__(self, parent)   
         
        self.parent = parent
        
        self.initUI()
        
    def initUI(self):
      
        self.parent.title("Buttons")
        self.style = Style()
        self.style.theme_use("default")
        
        frame = Frame(self, relief=RAISED, borderwidth=1)
        frame.pack(fill=BOTH, expand=1)
        #We create another Frame widget. 
        #This widget takes the bulk of the area. 
        #We change the border of the frame so that the frame is visible. 
        #By default it is flat.
        
        self.pack(fill=BOTH, expand=1)
        
        closeButton = Button(self, text="Close")
        closeButton.pack(side=RIGHT, padx=5, pady=5)
        #A closeButton is created. 
        #It is put into a horizontal box. 
        #The side parameter will create a horizontal box layout, in which the button is placed to the right of the box. 
        #The padx and the pady parameters will put some space between the widgets. 
        #The padx puts some space between the button widgets and between the closeButton and the right border of the root window. 
        #The pady puts some space between the button widgets and the borders of the frame and the root window.
        okButton = Button(self, text="OK")
        okButton.pack(side=RIGHT)
Exemple #11
0
    def init_ui(self):
        """ Initializes the GUI Tkinter window"""
        # window title
        self.parent.title("Titanic Mortality Prediction Analysis")
        #self.style = Style()
        style = Style()

        #self.style.theme_use("default")
        # has better dropdown arrows than default
        style.theme_use("clam")

        self.pack(fill=BOTH, expand=1)
        # pack() is one of the three geometry managers in Tkinter.
        # It organizes widgets into horizontal and vertical boxes.
        # Here we put the Frame widget, accessed via the self attribute
        # to the Tk root window. It is expanded in both directions.
        # In other words, it takes the whole client space of the
        # root window.

        # create a grid 3x6 in to which we will place elements.
        self.setup_grid()

        # create the main text area with scrollbars
        self.create_scrollable_text_area()

        # create the buttons/checkboxes to go along the bottom
        self.setup_widgets()

        # tags are used to colorize the text added to the text widget.
        # see self.addTtext and self.tags_for_line
        assert self.textarea is not None, 'textarea not set before use'
        self.textarea.tag_config("errorstring", foreground="#CC0000")
        self.textarea.tag_config("infostring", foreground="#008800")

        self.display_intro()
Exemple #12
0
class Example(Frame):
    def __init__(self, parent):  # construtor da classe/frame

        #Frame.__init__(self, parent, background="white") # devido ao uso do style.theme não pude escolher o background aqui
        #self.parent = parent
        #self.initUI()

        Frame.__init__(self, parent)
        self.parent = parent
        self.initUI()

    def initUI(self):
        self.parent.title("Computação Gráfica - UFT")
        self.style = Style()
        self.style.theme_use("default")
        self.pack()  # apenas um teste

        # botao para tracar a reta
        okButton = Button(self, text="OK")
        okButton.place(x=300, y=430)
        okButton.pack()

        # botao para fechar a aplicação
        quitButton = Button(
            self, text="Fechar",
            command=self.quit)  # o titulo do botao deveria ser Sair
        quitButton.place(
            x=300,
            y=460)  # posiciona o botão nas coordenadas aqui especificadas
        quitButton.pack()
class AutoAim(Frame):

    def __init__(self, parent):
        Frame.__init__(self, parent)

        self.parent = parent
        self.makeButtons()

    def makeButtons(self):

        self.parent.title("AutoAim")
        self.style = Style()
        self.style.theme_use("default")

        frame = Frame(self, relief=RAISED, borderwidth=1)
        frame.pack(fill=BOTH, expand=1)

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


        # put the option to generate in the bottom and the text entries in the lower left
        generate = Button(self, text="Generate", fg="red", command = getEntries)
        generate.pack(side=LEFT, padx=30, pady=30)

        emailTo = Button(self, text="Save Session", fg="red", command = file_save)
        emailTo.pack(side=LEFT, padx=30, pady=30)

        # put the option to generate a slow spiral
        slow = Button(self, text="Fine", fg="red", command = smallSpiral)
        slow.pack(side=RIGHT, padx=10, pady=20)

        # put the option to generate a quick spiral
        fast = Button(self, text="Coarse", fg="red", command = bigSpiral)
        fast.pack(side=RIGHT, padx=10, pady=10)
class Example(Frame):
    def __init__(self, parent):
        Frame.__init__(self, parent)

        self.parent = parent

        self.initUI()

    def initUI(self):

        self.parent.title("Buttons")
        self.style = Style()
        self.style.theme_use("default")

        frame = Frame(self, relief=RAISED, borderwidth=1)
        frame.pack(fill=BOTH, expand=1)

        frame2 = Frame(self, relief=RAISED, borderwidth=2)
        frame2.pack(fill=BOTH, expand=1)

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

        closeButton = Button(self, text="Close")
        closeButton.pack(side=RIGHT, padx=5, pady=5)
        okButton = Button(self, text="OK")
        okButton.pack(side=RIGHT)
class Example(Frame):
    def __init__(self, parent):
        # Frame.__init__(self, parent, background="white")  #Tkinter Frame
        Frame.__init__(self, parent)    # ttk Frame
        self.parent = parent
        self.initUI()

    def initUI(self):
        self.parent.title("Drawing Window")
        self.style = Style()
        self.style.theme_use("default")
        self.pack(fill=BOTH, expand=True)

        frameL = Frame(self, relief=RAISED, borderwidth=2)
        frameL.pack(fill=BOTH, expand=True)
        lbMax = Label(frameL, text="Maximum Arrangment", width=25)
        lbMax.pack(side=TOP, padx=5, pady=5)
        canvas = Canvas(frameL)
        canvas.create_rectangle(30, 10, 120, 80, outline="#fff", fill="#fff")

        frameR = Frame(self, relief=RAISED, borderwidth=2)
        frameR.pack(fill=BOTH, expand=True)
        lbMin = Label(frameR, text="Minimum Arrangment", width=25)
        lbMin.pack(side=TOP, padx=5, pady=5)

        quitButton = Button(self, text="Quit", command=self.quit)
        quitButton.pack(side=RIGHT, padx=10, pady=10)
Exemple #16
0
class Example(Frame):
    def __init__(self,parent):
        Frame.__init__(self,parent)
        self.parent = parent
        self.initUI()

    def initUI(self):
        self.parent.title("windows widget")
        self.style = Style()
        self.style.theme_use("default")
        self.pack(fill= BOTH, expand=1)

        self.columnconfigure(1,weight=1)
        self.columnconfigure(3,pad=7)
        self.rowconfigure(3,weight=1)
        self.rowconfigure(5,pad=7)

        lbl = Label(self, text = "Windows")
        lbl.grid(sticky = W, pady=4, padx=5)

        area = Text(self)
        area.grid(row=1, column=0, columnspan=3, rowspan=4, padx=5, sticky = E+W+S+N)
        abtn = Button(self, text="Activate")
        abtn.grid(row=1, column=3)

        cbtn = Button(self, text="Close")
        cbtn.grid(row=2, column=3, pady=4)

        hbtn = Button(self, text="Help")
        hbtn.grid(row=5, column=0, padx=5)

        obtn = Button(self, text = "OK")
        obtn.grid(row=5, column=3)
class Example(Frame):
    def __init__(self, parent):
        Frame.__init__(self, parent)

        self.parent = parent

        self.initUI()

    def initUI(self):

        self.parent.title("Buttons")
        self.style = Style()
        self.style.theme_use("default")

        frame = Frame(self, relief=RAISED, borderwidth=1)
        frame.pack(fill=BOTH, expand=1)

        frame2 = Frame(self, relief=RAISED, borderwidth=2)
        frame2.pack(fill=BOTH, expand=1)

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

        closeButton = Button(self, text="Close")
        closeButton.pack(side=RIGHT, padx=5, pady=5)
        okButton = Button(self, text="OK")
        okButton.pack(side=RIGHT)
class DialogScale(Frame):
    def __init__(self, parent):
        Frame.__init__(self, parent)

        self.parent = parent
        self.initUI()

    def initUI(self):

        self.parent.title("Compression")
        self.style = Style()
        self.style.theme_use("default")

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

        scale = Scale(self, from_=0, to=255,command=self.onScale, orient= HORIZONTAL)
        scale.place(x=90, y=20)


        self.label2 = Label(self, text="Choisissez un niveau de compression")
        self.label2.place(x=52, y=0)
        self.quitButton = Button(self, text="    Ok    ",command=self.ok)
        self.quitButton.place(x=120, y=65)

    def onScale(self, val):

        self.variable = int(val)

    def ok(self):
        global compress
        compress = self.variable
        self.quit()
class Example(Frame):
      
    def __init__(self, parent):
        Frame.__init__(self, parent)   
         
        self.parent = parent
        
        self.initUI()
        
    #setting up the GUI    
    def initUI(self):
        #sets the title of the window  
        self.parent.title("Do you dare to Zlatan?")
        self.style = Style()
        self.style.theme_use("alt")
        #creates an object for the window
        self.pack(fill=BOTH, expand=1)
        #makes buttons
        quitButton = Button(self, text="No, Zlatan sucks",
            command=self.quit)
        quitButton.place(x=30, y=50)

        webbutton = Button(self, text="Yes, #DaretoZlatan", command=self.OpenUrl)
        webbutton.place(x=130, y=50)
    #defines what the buttons do    
    def quit(self):
        self.parent.destroy()

    def OpenUrl(self):
        webbrowser.open_new('https://www.youtube.com/watch?v=ia-zi5oLa_0')
Exemple #20
0
class Example(Frame):
  
    def __init__(self, parent):
        Frame.__init__(self, parent)   
         
        self.parent = parent
        
        self.initUI()
        
    def initUI(self):
      
        self.parent.title("Buttons")
        self.style = Style()
        self.style.theme_use("default")
        
        frame = Frame(self, relief=RAISED, borderwidth=1)
        frame.pack(fill=BOTH, expand=1)
        
        self.pack(fill=BOTH, expand=1)
        
        closeButton = Button(self, text="Close")
        closeButton.pack(side=RIGHT, padx=5, pady=5)
            # The side parameter will create a horizontal box layout, 
            # in which the button is placed to the right of the box. 
            # The padx and the pady parameters will put some space be
        okButton = Button(self, text="OK")
        okButton.pack(side=RIGHT)
Exemple #21
0
class Example(Frame):
    def __init__(self, parent):
        Frame.__init__(self, parent)

        self.parent = parent
        self.initUI()

    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.place(x=20, y=20)

        self.var = IntVar()
        self.label = Label(self, text=0, textvariable=self.var)
        self.label.place(x=130, y=70)

    def onScale(self, val):

        v = int(float(val))
        self.var.set(v)
Exemple #22
0
class KnnFrame(Frame):
    def __init__(self, parent):
        Frame.__init__(self, parent, background="white")
        self.parent = parent
        self.style = Style()
        self.init_ui()

    def center_window(self):
        width_knn = 500
        height_knn = 500

        sw = self.parent.winfo_screenwidth()
        sh = self.parent.winfo_screenheight()

        x = (sw - width_knn) / 2
        y = (sh - height_knn) / 2

        self.parent.geometry('%dx%d+%d+%d' % (width_knn, height_knn, x, y))

    def init_ui(self):
        self.parent.title("knn - Classification")
        self.style.theme_use("default")

        self.pack(fill=BOTH, expand=1)
        self.center_window()
        quit_button = Button(self, text="Close", command=self.quit)
        quit_button.place(x=50, y=50)
Exemple #23
0
class CommAdd(Frame):
  
    def __init__(self, parent):
        Frame.__init__(self, parent)   
         
        self.parent = parent        
        self.initUI()
        
    def initUI(self):
        # This should be different if running on Windows....
        content = pyperclip.paste()
        print content  
        self.entries_found = []

        self.parent.title("Add a new command card")
        self.style = Style()
        self.style.theme_use("default")        
        self.pack()
        
        self.new_title_label = Label(self, text="Title")
        self.new_title_label.grid(row=0, columnspan=2)
        self.new_title_entry = Entry(self, width=90)
        self.new_title_entry.grid(row=1, column=0)
        self.new_title_entry.focus()
        self.new_content_label = Label(self, text="Card")
        self.new_content_label.grid(row=2, columnspan=2)
        self.new_content_text = Text(self, width=110, height=34)
        self.new_content_text.insert(END, content)
        self.new_content_text.grid(row=3, columnspan=2)
        self.add_new_btn = Button(self, text="Add New Card", command=self.onAddNew)
        self.add_new_btn.grid(row=4)

    def onAddNew(self):

        pass
Exemple #24
0
class Example(Frame):

    def __init__(self,parent):
        Frame.__init__(self,parent)
        self.parent=parent
        self.initUI()

    def close_window():
        root.destroy()

    def initUI(self):
        self.parent.title("Buttons")
        self.style=Style()
        self.style.theme_use("default")

        frame = Frame(self, relief=RAISED, borderwidth=1)
        frame.pack(fill=BOTH, expand=1)

        bard = Image.open("images.jpg")
        bardejov = ImageTk.PhotoImage(bard)
        label1 = Label(frame, image=bardejov)
        label1.image = bardejov
        label1.place(x=20, y=20)

        
        self.pack(fill=BOTH, expand=1)
        closebutton = Button(self, text="Close")
        closebutton.pack(side=RIGHT, padx=5, pady=5)
        okbutton = Button(self, text="OK")
        okbutton.pack(side=RIGHT)
Exemple #25
0
class Example(Frame):
  
    def __init__(self, parent):
        Frame.__init__(self, parent)   
         
        self.parent = parent
        
        self.initUI()
        
    def initUI(self):
      
        self.parent.title("Quit button")
        self.style = Style()
        self.style.theme_use("default")

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

        quitButton = Button(self, text="Quit",
            command=self.quit)
        quitButton.place(x=50, y=50)

    def display_bots:
    	pass

    def 
Exemple #26
0
class packManagerwButtons(Frame):
    #this uses the pack manager, there are also the grid manager and the geometry manager
    def __init__(self, parent):
        Frame.__init__(self,parent)

        self.parent = parent

        self.initUI()

    def initUI(self):
        self.parent.title("Buttons")
        self.style = Style()
        self.style.theme_use("default")


        #this is an additional frame
        frame = Frame(self,relief=RAISED, borderwidth=1)
        frame.pack(fill=BOTH, expand=1)

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

        closeButton = Button(self, text="Close")
        closeButton.pack(side=RIGHT, padx=5, pady=5)
        okButton = Button(self,text="OK")
        okButton.pack(side=RIGHT)
Exemple #27
0
class Example(Frame):
  
    def __init__(self, parent):
        Frame.__init__(self, parent)   
         
        self.parent = parent
        
        self.initUI()
        
    def initUI(self):
      
        self.parent.title("Buttons")
        self.style = Style()
        self.style.theme_use("default")
        
        #Pack the root frame
        self.pack(fill=BOTH, expand=1)
        
        #Create another frame 
        frame = Frame(self, relief=RAISED, borderwidth=1)
        frame.pack(fill=BOTH, expand=1)
        
        #Pack two buttons to the bottom right
        closeButton = Button(self, text="Close")
        closeButton.pack(side=RIGHT, padx=5, pady=5)
        okButton = Button(self, text="OK")
        okButton.pack(side=RIGHT)
Exemple #28
0
class AutoAim(Frame):
    def __init__(self, parent):
        Frame.__init__(self, parent)

        self.parent = parent
        self.makeButtons()

    def makeButtons(self):

        self.parent.title("AutoAim")
        self.style = Style()
        self.style.theme_use("default")

        frame = Frame(self, relief=RAISED, borderwidth=1)
        frame.pack(fill=BOTH, expand=1)

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

        # put the option to generate in the bottom and the text entries in the lower left
        generate = Button(self, text="Generate", fg="red", command=getEntries)
        generate.pack(side=LEFT, padx=30, pady=30)

        emailTo = Button(self,
                         text="Save Session",
                         fg="red",
                         command=file_save)
        emailTo.pack(side=LEFT, padx=30, pady=30)

        # put the option to generate a slow spiral
        slow = Button(self, text="Fine", fg="red", command=smallSpiral)
        slow.pack(side=RIGHT, padx=10, pady=20)

        # put the option to generate a quick spiral
        fast = Button(self, text="Coarse", fg="red", command=bigSpiral)
        fast.pack(side=RIGHT, padx=10, pady=10)
Exemple #29
0
class Example(Frame):

    def __init__(self,parent):
        Frame.__init__(self, parent)
        self.parent = parent
        self.initUI()

    def initUI(self):
        #<standard set up>
        self.parent.title("Buttons")
        self.style = Style()
        self.style.theme_use("default")
        #</standard set up>

        #if you put buttons here, it will initiate the buttons.
        #then it will initiate the frame. You would get two columns.
        #buttons appear in the second "lowered" area and not the raised frame.

        
        
        #<adding an additional frame>
        frame = Frame(self, relief=RAISED, borderwidth=1)
        
        frame.pack(fill=BOTH, expand =1)
        #</adding an additional frame>

        #<standard self.pack>
        self.pack(fill=BOTH, expand =1)
        #</standard self.pack>

        #<buttons are placed here>
        closeButton = Button (self, text = "Close")
        closeButton.pack(side=RIGHT, padx=5, pady =5)
        okButton = Button(self, text = "OK")
        okButton.pack(side=RIGHT)
Exemple #30
0
class Example(Frame):
    def __init__(self, parent):
        # Frame.__init__(self, parent, background="white")  #Tkinter Frame
        Frame.__init__(self, parent)  # ttk Frame
        self.parent = parent
        self.initUI()

    def initUI(self):
        self.parent.title("Drawing Window")
        self.style = Style()
        self.style.theme_use("default")
        self.pack(fill=BOTH, expand=True)

        frameL = Frame(self, relief=RAISED, borderwidth=2)
        frameL.pack(fill=BOTH, expand=True)
        lbMax = Label(frameL, text="Maximum Arrangment", width=25)
        lbMax.pack(side=TOP, padx=5, pady=5)
        canvas = Canvas(frameL)
        canvas.create_rectangle(30, 10, 120, 80, outline="#fff", fill="#fff")

        frameR = Frame(self, relief=RAISED, borderwidth=2)
        frameR.pack(fill=BOTH, expand=True)
        lbMin = Label(frameR, text="Minimum Arrangment", width=25)
        lbMin.pack(side=TOP, padx=5, pady=5)

        quitButton = Button(self, text="Quit", command=self.quit)
        quitButton.pack(side=RIGHT, padx=10, pady=10)
Exemple #31
0
class myApp(Frame):
    def __init__(self, parent):
        Frame.__init__(self, parent, background="white")
        self.parent = parent
        self.initUI()

    def initUI(self):
        w = self.parent.winfo_screenwidth() / 2
        h = self.parent.winfo_screenheight() / 2

        sw = self.parent.winfo_screenwidth()
        sh = self.parent.winfo_screenheight()

        x = (sw - w) / 2
        y = (sh - h) / 2

        self.parent.geometry('%dx%d+%d+%d' % (w, h, x, y))

        self.parent.title("myApp")
        self.style = Style()
        self.style.theme_use("default")

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

        quitButton = Button(self, text="Quit", command=self.quit)
        quitButton.place(x=w / 2, y=h / 2)
Exemple #32
0
class TK_Framework(object):
    def __init__(self):
        self.root = Tk()

        # list of open windows
        self.windows = {'main':self.root}

        # setup the overall style of the gui
        self.style = Style()
        self.style.theme_use('clam')

    def get_window(self,name):
        return self.windows[name]

    def create_window(self, name):
        self.windows[name] = Toplevel()
    
    
    @staticmethod
    def open_file(init_dir):
        filename = askopenfilename(initialdir=init_dir)
        return filename

    def hide_root(self):
        """Hides the root window"""
        self.root.withdraw()

    def get_root(self):
        return self.root
class MainFrame(Frame):
    def __init__(self, parent):
        Frame.__init__(self, parent)
        self.parent = parent
        self.initUI()

    def initUI(self):
        self.parent.title("Content recommendation - Test prototype")
        self.style = Style()
        self.style.theme_use("clam")
        self.pack(fill=BOTH, expand=1)
        # Create the buttons
        quitButton = Button(self, text="Quit", command=self.quit)
        quitButton.pack()
        global content_seen
        content_seen = StringVar()
        content_seen.set("0/" + str(MAX_CONTENT))
        button = Button(self, text="Show next content", command=lambda: go_next(button, content_seen))
        button.pack()
        if MAX_CONTENT:
            Label(self, textvariable=content_seen).pack()
        

    def quit(self):
        if MAX_CONTENT and content_number < MAX_CONTENT:
            result = tkMessageBox.askquestion("Quit", "Are you sure ? Your session is incomplete...", icon='warning') == 'yes'
        else:
            result = True
        if result:
            stop_detection()
            Frame.quit(self)
Exemple #34
0
class MainFrame(Frame):
    def __init__(self, parent):
        Frame.__init__(self, parent)
        self.parent = parent
        self.initUI()

    def initUI(self):
        self.parent.title("Content recommendation - Test prototype")
        self.style = Style()
        self.style.theme_use("clam")
        self.pack(fill=BOTH, expand=1)
        # Create the buttons
        quitButton = Button(self, text="Quit", command=self.quit)
        quitButton.pack()
        global content_seen
        content_seen = StringVar()
        content_seen.set("0/" + str(MAX_CONTENT))
        button = Button(self,
                        text="Show next content",
                        command=lambda: go_next(button, content_seen))
        button.pack()
        if MAX_CONTENT:
            Label(self, textvariable=content_seen).pack()

    def quit(self):
        if MAX_CONTENT and content_number < MAX_CONTENT:
            result = tkMessageBox.askquestion(
                "Quit",
                "Are you sure ? Your session is incomplete...",
                icon='warning') == 'yes'
        else:
            result = True
        if result:
            stop_detection()
            Frame.quit(self)
Exemple #35
0
class FACSMainWindow(Frame):
  
    def __init__(self, parent):
        Frame.__init__(self, parent)         
        self.parent = parent        
        self.initUIConstants()
        self.initUI()

        self.inputDirectory = ""
        self.outputDirectory = ""

    def initUIConstants(self):
        # defining options for opening a directory
        self.dir_opt = options = {}
        options['initialdir'] = 'C:\\'
        options['mustexist'] = False
        options['parent'] = self
        options['title'] = 'Select directory for FACS:'


    def initUI(self):
      
        self.parent.title("FACS machine output analyzer")
        self.style = Style()
        self.style.theme_use("default")        
        self.pack()

        inputDir = Button(self, text='Select input directory', command=self.askInputDirectory)
        inputDir.grid(row=0, column=1)

        outputDir = Button(self, text="Select output directory", command=self.askOutputDirectory)
        outputDir.grid(row=1)

        processFiles = Button(self, text="Process", command=self.processData)
        processFiles.grid(row=2)


    def onError(self):
        box.showerror("Error", "Could not open file")
        
    def onWarn(self):
        box.showwarning("Warning", "Deprecated function call")
        
    def onQuest(self):
        box.askquestion("Question", "Are you sure to quit?")
        
    def onProcessingEnd(self):
        box.showinfo("Information", "Processing complete!\n\nOutput location" + self.outputDirectory)
         
    def askInputDirectory(self):
        """Returns a selected directoryname."""
        self.inputDirectory = tkFileDialog.askdirectory(**self.dir_opt)    

    def askOutputDirectory(self):
        """Returns a selected directoryname."""
        self.outputDirectory = tkFileDialog.askdirectory(**self.dir_opt)

    def processData (self):
        self.onProcessingEnd(); 
Exemple #36
0
class error_window(Frame):
    def __init__(self, parent):
        Frame.__init__(self, parent)
        self.parent = parent
        self.initUI(parent)

    def initUI(self, parent):
        self.style = Style()
        self.style.theme_use("classic")
        Style().configure("TLabel", font='serif 10', weight="Bold")

        # creating layout from frames
        self.frame0 = Frame(parent)
        self.frame0.pack(fill="both", expand="True")
        self.frame1 = Frame(parent)
        self.frame1.pack(fill="both", expand="True")
        self.frame2 = Frame(parent)
        self.frame2.pack(fill="both", expand="True")
        self.frame3 = Frame(parent)
        self.frame3.pack(fill="both", expand="True")
        self.frame4 = Frame(parent)
        self.frame4.pack(fill="both", expand="True")
        self.frame5 = Frame(parent)
        self.frame5.pack(fill="both", expand="True")

        # putting text in frame1
        msg1 = "File or Directory not found:"
        msg2 = "1. It has been deleted"
        msg3 = "2. Was never created"
        msg4 = "3. Someone has modified file 'last_address.txt'"
        msg5 = "Please re-enter address"
        Label(self.frame0,
              text=msg1,
              font="Helvetica 11 bold",
              anchor='center').pack(side="top")
        Label(self.frame1, text=msg2, font="Helvetica 10	  ",
              anchor='nw').pack(side="left", padx=5)
        Label(self.frame2, text=msg3, font="Helvetica 10	  ",
              anchor='nw').pack(side="left", padx=5)
        Label(self.frame3, text=msg4, font="Helvetica 10	  ",
              anchor='nw').pack(side="left", padx=5)
        Label(self.frame4,
              text=msg5,
              font="Helvetica 11 bold",
              anchor='center').pack(side="top")

        # putting button in frame2
        self.b12 = Button(self.frame5,
                          text="Ok",
                          width=7,
                          state="active",
                          font='serif 10',
                          command=self.clicked)
        self.b12.pack()
        self.b12.bind('<Return>', self.clicked)

    def clicked(self, *args):
        self.quit()
Exemple #37
0
class Login(Frame):
    """******** Funcion: __init__ **************
    Descripcion: Constructor de Login
    Parametros:
    self Login
    parent Tk
    Retorno: void
    *****************************************************"""
    def __init__(self, parent):
        Frame.__init__(self, parent)
        self.parent = parent
        self.initUI()


    """******** Funcion: initUI **************
    Descripcion: Inicia la interfaz grafica de un Login,
                para ello hace uso de Frames y Widgets.
    Parametros:
    self Login
    Retorno: void
    *****************************************************"""
    def initUI(self):
        self.parent.title("Pythagram: Login")
        self.style = Style()
        self.style.theme_use("default")

        self.frame = Frame(self, relief=RAISED)
        self.frame.pack(fill=BOTH, expand=1)
        self.instructions = Label(self.frame,text="A new Web Browser window will open, you must log-in and accept the permissions to use this app.\nThen you have to copy the code that appears and paste it on the next text box.")
        self.instructions.pack(fill=BOTH, padx=5,pady=5)
        self.codeLabel = Label(self.frame,text="Code:")
        self.codeLabel.pack(fill=BOTH, padx=5,pady=5)
        self.codeEntry = Entry(self.frame)
        self.codeEntry.pack(fill=BOTH, padx=5,pady=5)
        self.pack(fill=BOTH, expand=1)

        self.closeButton = Button(self, text="Cancel", command=self.quit)
        self.closeButton.pack(side=RIGHT, padx=5, pady=5)
        self.okButton = Button(self, text="OK", command=self.login)
        self.okButton.pack(side=RIGHT)

    """******** Funcion: login **************
    Descripcion: Luego que el usuario ingresa su codigo de acceso, hace
                la solicitud al servidor para cargar su cuenta en una
                ventana de tipo Profile
    Parametros:
    self
    Retorno: Retorna...
    *****************************************************"""
    def login(self):
        code = self.codeEntry.get()
        api = InstagramAPI(code)
        raw = api.call_resource('users', 'info', user_id='self')
        data = raw['data']
        self.newWindow = Toplevel(self.parent)
        global GlobalID
        GlobalID = data['id']
        p = Profile(self.newWindow,api,data['id'])
Exemple #38
0
class Example(Frame):
    def __init__(self, parent):
        Frame.__init__(self, parent)

        self.parent = parent

        self.initUI()

    def initUI(self):

        self.parent.title("Paste IP's Here:")
        self.style = Style()
        self.style.theme_use("aqua")
        self.pack(fill=BOTH, expand=1)

        self.columnconfigure(1, weight=1)
        self.columnconfigure(3, pad=7)
        self.rowconfigure(3, weight=1)
        self.rowconfigure(5, pad=7)

        lbl = Label(self, text="Paste IP's Here:")
        lbl.grid(sticky=W, pady=4, padx=5)

        area = Text(self)
        area.grid(row=1,
                  column=0,
                  columnspan=2,
                  rowspan=4,
                  padx=5,
                  sticky=E + W + S + N)

        abtn = Button(self, text="Open", command=self.onOpen())
        abtn.grid(row=1, column=3)

        cbtn = Button(self, text="Close")
        cbtn.grid(row=2, column=3, pady=4)

        hbtn = Button(self, text="Help")
        hbtn.grid(row=5, column=0, padx=5)

        obtn = Button(self, text="OK")
        obtn.grid(row=5, column=3)

    def onOpen(self):

        ftypes = [('All files', '*')]
        dlg = tkFileDialog.Open(self, filetypes=ftypes)
        fl = dlg.show()

        if fl != '':
            text = self.readFile(fl)
            self.area.insert(END, text)

    def readFile(self, filename):

        f = open(filename, "r")
        text = f.read()
        return text
Exemple #39
0
class ImageFrame(Frame):
    def __init__(self, parent):
        Frame.__init__(self, parent)
        self.parent = parent
        self.setup()
        self.initUI()
        self.schedule()

    def setup(self):
        self.capture = cv2.VideoCapture(0)
        self.key = StringVar()
        self.val = DoubleVar()


    def initUI(self):
        self.parent.title("Buttons")
        self.style = Style()
        self.style.theme_use("default")

        frame = Frame(self, relief=GROOVE, borderwidth=5)
        frame.pack(fill=BOTH, expand=1)
        self.pack(fill = BOTH, expand = 1)

        self.imageLabel = Label(frame, image = "")
        self.imageLabel.pack(fill=BOTH, expand=1)

        closeButton = Button(self, text="Close")
        closeButton.pack(side=RIGHT)
        okButton = Button(self, text="OK")
        okButton.pack(side=RIGHT)

        options = [item for item in dir(cv2.cv) if item.startswith("CV_CAP_PROP")]
        option = OptionMenu(self, self.key, *options)
        self.key.set(options[0])
        option.pack(side="left")

        spin = Spinbox(self, from_=0, to=1, increment=0.05)
        self.val = spin.get()
        spin.pack(side="left")


    def schedule(self):
        def captureImg():
            ret, frame = self.capture.read()
            # Convert the Image object into a TkPhoto object
            b,g,r = cv2.split(frame)
            frame = cv2.merge((r,g,b))
            im = Image.fromarray(frame)
            im = im.resize((640, 480),Image.ANTIALIAS)


            imgtk = ImageTk.PhotoImage(image=im)
            # Put it in the display window
            self.imageLabel.configure(image = imgtk)
            self.imageLabel.image = imgtk
            self.after(100, captureImg)

        self.after(100, captureImg)
class MainFrame(Frame):    
    def __init__(self, parent):
        Frame.__init__(self, parent)   
        self.parent = parent
        self.initUI()    
              
    def initUI(self):
        self.parent.title("Driver Control Panel")
        self.style = Style()
        self.style.theme_use("default")
        self.pack(fill=BOTH, expand=1)

        self.label = Label(self, text="Bus Tracker - Driver", font=('Helvetica', '21'))
        self.label.grid(row=0, column=0)

        self.l = Label(self, text="Bus Line", font=('Helvetica', '18'))
        self.l.grid(row=1, column=0)
        self.e = Entry(self, font=('Helvetica', '18'))
        self.e.grid(row=2, column=0)

        self.l = Label(self, text="Direction", font=('Helvetica', '18'))
        self.l.grid(row=3, column=0)

        # add vertical space
        self.l = Label(self, text="", font=('Helvetica', '14'))
        self.l.grid(row=5, column=0)

        self.e = Entry(self, font=('Helvetica', '18'))
        self.e.grid(row=4, column=0)
        self.search = Button(self, text="Start")
        self.search.grid(row=6, column=0)   
        
        
        ######### used for debug ##########
        # add vertical space
        self.l2 = Label(self, text="", font=('Helvetica', '14'))
        self.l2.grid(row=5, column=0)
        
        self.turnOnBtn = Button(self, text="Turn On")
        self.turnOnBtn["command"] = self.turnOn 
        self.turnOnBtn.grid(row=6, column=0)    
        
        self.startBtn = Button(self, text="Start")
        self.startBtn["command"] = self.start 
        self.startBtn.grid(row=7, column=0)    
        
        self.turnOffBtn = Button(self, text="Turn Off")
        self.turnOffBtn["command"] = self.turnOff 
        self.turnOffBtn.grid(row=8, column=0)   
        
    def turnOn(self):
        host.enqueue({"SM":"DRIVER_SM", "action":"turnOn", "busId":DRIVERID, "localIP":IP, "localPort":int(PORT)})
        
    def start(self):
        host.enqueue({"SM":"DRIVER_SM", "action":"start", "route":ROUTNO, "direction":"north", "location":(0,0)})
        
    def turnOff(self):
        host.enqueue({"SM":"DRIVER_SM", "action":"turnOff"})    
Exemple #41
0
class Example(Frame):
    def __init__(self, parent):
        Frame.__init__(self, parent)

        self.parent = parent

        self.initUI()

    def initUI(self):

        self.parent.title("Graphs")
        self.style = Style()
        self.style.theme_use("clam")
        self.pack(fill=BOTH, expand=1)

        self.columnconfigure(1, weight=1)
        self.columnconfigure(3, weight=1)
        self.columnconfigure(6, pad=7)
        self.rowconfigure(3, weight=1)
        self.rowconfigure(5, pad=7)

        lbl = Label(self, text="Graphs")
        lbl.grid(sticky=W, pady=4, padx=5)

        area1 = ScrolledList(self, ['a', 'b,', 'c', 'd', 'e'],
                             lambda x: self.load_hunt_data(x))
        area1.grid(row=1,
                   column=0,
                   columnspan=3,
                   rowspan=4,
                   padx=5,
                   sticky=E + W + S + N)

        area2 = TkinterGraph(self)
        area2.grid(row=1,
                   column=3,
                   columnspan=2,
                   rowspan=4,
                   padx=5,
                   sticky=E + W + S + N)

        btn1 = Button(self, text="Left")
        btn1.grid(row=1, column=6)

        btn2 = Button(self, text="Right")
        btn2.grid(row=2, column=6, pady=4)

        btn3 = Button(self, text="csv")
        btn3.grid(row=5, column=0, padx=5)

        btn5 = Button(self, text="dat")
        btn5.grid(row=5, column=2, padx=5)

        btn4 = Button(self, text="OK")
        btn4.grid(row=5, column=6)

    def load_hunt_data(self, selection):
        pass
Exemple #42
0
class MainWindow(Frame):
    def __init__(self, parent):
        Frame.__init__(self, parent)

        self.setupUI()

    def setupUI(self):
        self.master.title("Markwhat")
        self.style = Style()
        self.style.theme_use("default")
        self.pack(fill=BOTH, expand=1)
        self.grid_columnconfigure(0, weight=1)
        self.grid_columnconfigure(1, weight=1)
        self.rowconfigure(1, weight=1)

        self.markwhat_label = Label(self, text="Markwhat")
        self.markwhat_label.grid(sticky=W, row=0, column=0)

        self.markwhat_textarea = WhatText(self, background='white')
        self.markwhat_textarea.grid(row=1, column=0, sticky=NSEW)
        self.markwhat_textarea.beenModified = self.on_markwhat_modfified

        self.markup_label = Label(self, text="Markup")
        self.markup_label.grid(sticky=W, row=0, column=1)

        self.markup_preview = HtmlFrame(self)
        self.markup_preview.grid(row=1, column=1, sticky=NSEW)

        self.preview_button_text = StringVar()
        self.preview_button = Button(
            self,
            textvariable=self.preview_button_text,
            command=self.on_preview_click,
        )
        self.preview_button_text.set('HTML')
        self.preview_button.grid(row=2, column=1, sticky=W)

    def on_markwhat_modfified(self, event):
        text = self.markwhat_textarea.get('1.0', END)
        markup_text = parse_markdown(text)

        if isinstance(self.markup_preview, HtmlFrame):
            self.markup_preview.set_content(markup_text)
        else:
            self.markup_preview.delete('1.0', END)
            self.markup_preview.insert('1.0', markup_text)

    def on_preview_click(self):
        if isinstance(self.markup_preview, HtmlFrame):
            self.markup_preview = WhatText(self, background="white")
            self.preview_button_text.set('HTML')
        else:
            self.markup_preview = HtmlFrame(self)
            self.preview_button_text.set('HTML Source')

        self.markup_preview.grid(row=1, column=1, sticky=NSEW)
        self.on_markwhat_modfified(None)
Exemple #43
0
class MainFrame(Frame):
    def __init__(self, parent):
        Frame.__init__(self, parent)
        self.parent = parent
        self.initUI()

        # define options for opening or saving a file
        self.file_opt = options_file = {}
        options_file['defaultextension'] = '.txt'
        options_file['filetypes'] = [('all files', '.*'),
                                     ('text files', '.txt')]
        options_file['initialdir'] = '../'
        options_file['initialfile'] = 'testFile'
        options_file['parent'] = self.parent
        options_file['title'] = 'Choose configuration file'

        # define options for asking local name
        self.ask_localname_opt = options_localName = {}
        options_localName['parent'] = self.parent
        options_localName['initialvalue'] = "alice"

        conf = tkFileDialog.askopenfilename(**self.file_opt)
        localName = tkSimpleDialog.askstring("local name",
                                             "Please enter your name:",
                                             **self.ask_localname_opt)

        MessagePasser.initialize(conf, localName)

    def initUI(self):
        self.parent.title("Bus Tracker")
        self.style = Style()
        self.style.theme_use("default")
        self.pack(fill=BOTH, expand=1)

        self.label = Label(self, text="Ready")
        self.label.grid(row=0, column=0)
        # TEST ONLY
        self.testButton = Button(
            self, text="Send", command=lambda: self.send("alice", "hi alice"))
        self.testButton.grid(row=1, column=0)
        self.testButton = Button(
            self,
            text="Multicast",
            command=lambda: self.multicast("group1", "hi group1"))
        self.testButton.grid(row=1, column=1)
        self.quitButton = Button(self, text="Quit", command=self.quit)
        self.quitButton.grid(row=1, column=2)

    def receive(self):
        self.label["text"] = MessagePasser.receive()
        #self.labelString.set(MessagePasser.receive())

    def send(self, dst, data):
        MessagePasser.normalSend(dst, data)

    def multicast(self, group, data):
        MessagePasser.multicast(group, data)
Exemple #44
0
class Example(Frame):
    def __init__(self, parent):
        Frame.__init__(self, parent)   
        self.parent = parent
        self.initUI()

    def run(self):
        t_action = threading.Thread(target = self.action, args=())
        t_action.start()

    def action(self):
        args = parse(sys.argv[1])
        progress = open(sys.argv[2], 'w')

        myMatcher = matcher(args['match_thres'], args['m'], args['fs'])
        myExecutor = executor()
        Q_record = Queue.Queue()
        Q_process = Queue.Queue()

        sdr = mySDR()
        sdr.set_up(args['fs'], args['fc'] - args['offset'], args['gain'])

        # Initiate database responsible for acquiring query data.
        database = db([], args['t'], args['m'], args['cutoff'], sdr, Q_record, fmDemod(), myAudio())

        t_record = threading.Thread(target = database.recordContinously, args = (progress,))
        t_record.start()

        time.sleep(args['process_delay'])

        # Stores data_ds in Q_process.
        t_process = threading.Thread(target = database.processContinously, args = (Q_process, progress, args['buff_size'], args['taps']))
        t_process.start()

        time.sleep(args['matcher_delay'])

        myMatcher.match_Queue(Q_process, myExecutor, args['diff_thres'])
   
    def close(self):
        print 'Exiting...'
        os._exit(0)

    def initUI(self):
        self.parent.title("HamPi")
        self.pack(fill=BOTH, expand=2)

        # self.parent.title("Process button")
        self.style = Style()
        self.style.theme_use("default")

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

        processButton = Button(self, text="Process", command=self.run)
        processButton.place(x=60, y=10)

        quitButton = Button(self, text="Quit", command=self.close)
        quitButton.place(x=140, y=10)
class MemoriseFrontend(Frame):
    version = "0.1-py"
    padding = 10

    def __init__(self, parent):
        Frame.__init__(self, parent)
        self.parent = parent
        self.style = Style()
        self.style.theme_use("default")

        self._initUI()

    def _initUI(self):
        self.parent.title("Memorise v" + self.version)

        self.columnconfigure(0, pad=self.padding)
        self.columnconfigure(1, pad=self.padding)
        self.columnconfigure(2, pad=self.padding)
        self.columnconfigure(3, pad=self.padding)
        self.columnconfigure(4, pad=self.padding)

        self.rowconfigure(0, pad=self.padding)
        self.rowconfigure(1, pad=self.padding)
        self.rowconfigure(2, pad=self.padding)
        self.rowconfigure(3, pad=self.padding)
        self.rowconfigure(4, pad=self.padding)

        # Row 1
        btnUp = Button(self, text="Up", command=self._onUpBtn)
        btnUp.grid(row=1, column=2)

        # Row 2
        btnLeft = Button(self, text="Left", command=self._onLeftBtn)
        btnLeft.grid(row=2, column=1)

        # Row 2
        btnRight = Button(self, text="Right", command=self._onRightBtn)
        btnRight.grid(row=2, column=3)

        # Row 3
        btnDown = Button(self, text="Down", command=self._onDownBtn)
        btnDown.grid(row=3, column=2)

        self.pack()

    def _onUpBtn(self):
        pass

    def _onLeftBtn(self):
        pass

    def _onRightBtn(self):
        pass

    def _onDownBtn(self):
        pass
class Example(Frame):

    def __init__(self, parent):
        Frame.__init__(self, parent)

        self.parent = parent

        self.initUI()

    def initUI(self):

        self.parent.title("Paste IP's Here:")
        self.style = Style()
        self.style.theme_use("aqua")
        self.pack(fill=BOTH, expand=1)

        self.columnconfigure(1, weight=1)
        self.columnconfigure(3, pad=7)
        self.rowconfigure(3, weight=1)
        self.rowconfigure(5, pad=7)

        lbl = Label(self, text="Paste IP's Here:")
        lbl.grid(sticky=W, pady=4, padx=5)

        area = Text(self)
        area.grid(row=1, column=0, columnspan=2, rowspan=4,
            padx=5, sticky=E+W+S+N)

        abtn = Button(self, text="Open", command=self.onOpen())
        abtn.grid(row=1, column=3)

        cbtn = Button(self, text="Close")
        cbtn.grid(row=2, column=3, pady=4)

        hbtn = Button(self, text="Help")
        hbtn.grid(row=5, column=0, padx=5)

        obtn = Button(self, text="OK")
        obtn.grid(row=5, column=3)

    def onOpen(self):

        ftypes = [('All files', '*')]
        dlg = tkFileDialog.Open(self, filetypes = ftypes)
        fl = dlg.show()

        if fl != '':
            text = self.readFile(fl)
            self.area.insert(END, text)

    def readFile(self, filename):

        f = open(filename, "r")
        text = f.read()
        return text
Exemple #47
0
class MainWindow(Frame):

    def __init__(self, parent):
        Frame.__init__(self, parent)

        self.parent = parent
        self.initUI()

    def initUI(self):

        self.parent.title("MyStock")
        self.style = Style()
        self.style.theme_use("default")

        frame = Frame(self, relief=RAISED, borderwidth=1)
        frame.pack(fill=BOTH, expand=True)

        menubar = Menu(self.parent)
        self.parent.config(menu=menubar)

        fileMenu = Menu(menubar)
        fileMenu.add_command(label="Exit", command=self.onExit)
        menubar.add_cascade(label="File", menu=fileMenu)

        submenu= Menu(fileMenu)
        submenu.add_command(label="New feed")
        submenu.add_command(label="Bookmarks")
        submenu.add_command(label="Mail")
        fileMenu.add_cascade(label='Import', menu=submenu, underline=0)

        fileMenu.add_separator()

        closeButton = Button(self, text="Close", command=self.quit)
        closeButton.pack(side=RIGHT, padx=5, pady=5)
        okButton = Button(self, text="OK")
        okButton.pack(side=RIGHT)

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

    def onExit(self):
        self.quit()

    def centerWindow(self):

        w = 750
        h = 450

        sw = self.parent.winfo_screenwidth()
        sh = self.parent.winfo_screenheight()

        x = (sw - w)/2
        y = (sh - h)/2
        self.parent.geometry('%dx%d+%d+%d' % (w, h, x, y))
Exemple #48
0
    def __init__(self, topframe=None):

        MyFrame.__init__(self, topframe=topframe)

        style = Style()
        style.theme_use('clam')

        self.patient_foler_path = ""
        self.patients = []
        self.set_title('Brain segmentation GUI')
        self.add_ui_components()
Exemple #49
0
class Intro(Frame):
    def __init__(self, parent):
        Frame.__init__(self, parent)
        self.parent = parent
        self.initUI()
        self.select_config()

    def initUI(self):
        self.parent.title("OPTICAL LATTICE")
        self.style = Style()
        self.style.theme_use("default")
        self.pack(fill=BOTH, expand=1)

    def select_config(self):
        def run_standard():
            root = Tk()
            standard = Standard(root)
            root.mainloop()

        def run_umbrella():
            root = Tk()
            umbrella = Umbrella(root)
            root.mainloop()

        ref1 = Label(self)
        ref2 = Label(self)
        ref3 = Label(self)
        ref4 = Label(self)
        owner = Label(self, text="Developer: Hoseong Asher Lee")
        univ = Label(self, text="Miami University, Oxford")
        git = Label(self, text="https://github.com/ohpyupi/optlattices")

        label = Label(self, text=" CHOOSE YOUR LASER CONFIGURATION")
        standard = Button(self,
                          text="Standard Tetrahedron",
                          command=run_standard)
        umbrella = Button(self, text="Umbrella", command=run_umbrella)
        quit = Button(self, text="Quit", command=self.quit)

        label.grid(row=0, column=0)
        ref1.grid(row=1, column=0)
        standard.grid(row=2, column=0)
        ref2.grid(row=3, column=0)
        umbrella.grid(row=4, column=0)

        ref3.grid(row=5, column=0)
        quit.grid(row=6, column=0)
        ref4.grid(row=7)
        owner.grid(row=8)
        univ.grid(row=9)
        git.grid(row=10)
Exemple #50
0
class mGUI(Frame):
    def __init__(self, parent):
        Frame.__init__(self, parent)

        self.parent = parent

        self.initUI()

    def initUI(self):

        self.parent.title("Finger Putty")
        self.style = Style()
        self.style.theme_use("default")

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

        # Logo text
        # logoText = Text(self)

        # OS drop-down button
        variable = StringVar(self)
        variable.set("Linux")

        osDropdownButton = OptionMenu(self, variable, "Choose your OS",
                                      "Linux", "Windows", "Playstation",
                                      "Revert Defaults")
        osDropdownButton.pack()
        osDropdownButton.place(x=50, y=50)

        # Set (OS) fingerprint button
        def fcallback():
            if variable.get() == "Revert Defaults":
                setctl.defaults()
            elif variable.get() != "Choose your OS":
                setctl.control(variable.get())

        changePrintButton = Button(self,
                                   text="Set fingerprint",
                                   command=fcallback)
        changePrintButton.place(x=50, y=80)

        # Launch browser button
        def bcallback():
            useragent.getVersion()
            useragent.launchBrowser()

        launchButton = Button(self,
                              text="Launch browser (new user-agent)",
                              command=bcallback)
        launchButton.place(x=50, y=110)
Exemple #51
0
class MsgResponder(Frame):
    def __init__(self, parent, text):
        Frame.__init__(self, parent)

        self.parent = parent
        self.text = text
        self.initUI()

    def btnClickedPass(self):
        #button clicked method - sets var to 1 and gets comments
        result = 1
        comment = "<comment>" + self.textBox.get("1.0", END) + "</comment>"
        print str(result)
        print comment
        self.quit()

    def btnClickedFail(self):
        #button clicked method - sets var to 0 and gets comments
        result = 0
        comment = "<comment>" + self.textBox.get("1.0", END) + "</comment>"
        print str(result)
        print comment
        self.quit()

    def initUI(self):

        #some aesthetic definitions
        self.parent.title("Message Responder")
        self.style = Style()
        self.style.theme_use("classic")

        #building frame
        frame = Frame(self, relief=RAISED, borderwidth=1)
        frame.pack(fill=BOTH, expand=True)

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

        #adding some widgets
        label = Label(frame, text=self.text, wraplength=495, justify=LEFT)
        label.pack()
        self.textBox = Text(frame, height=2, width=495)
        self.textBox.pack(side=BOTTOM)
        #self.textBox.insert(END, '#enter ye comments here')
        labelBox = Label(frame, text="Actual Results:")
        labelBox.pack(anchor=W, side=BOTTOM)
        passButton = Button(self, text="PASS", command=self.btnClickedPass)
        passButton.pack(side=RIGHT, padx=5, pady=5)
        failButton = Button(self, text="FAIL", command=self.btnClickedFail)
        failButton.pack(side=RIGHT)
Exemple #52
0
Fichier : biab.py Projet : ob/biab
 def layout_gui(self):
     master = self.master
     s = Style()
     s.theme_use('default')
     s.configure('TProgressbar', thickness=50)
     helv36 = tkFont.Font(family='Helvetica', size=36, weight='bold')
     b = Button(master, text="Quit", command=self.quit, width=10, height=2)
     b['font'] = helv36
     b.grid(row=0, column=0)
     pb = Progressbar(master,
                      orient=VERTICAL,
                      length=100,
                      mode='determinate',
                      style='TProgressbar')
     pb['value'] = 50
     pb.grid(row=0, column=1)
Exemple #53
0
class restart_window(Frame):
    def __init__(self, parent):
        Frame.__init__(self, parent)
        self.parent = parent
        self.initUI(parent)

    def initUI(self, parent):
        self.style = Style()
        self.style.theme_use("classic")
        Style().configure("TLabel", font='serif 10', weight="Bold")

        # creating layout from frames
        self.frame1 = Frame(parent)
        self.frame1.pack(fill="both", expand="True")
        self.frame2 = Frame(parent)
        self.frame2.pack(fill="both", expand="True")

        # putting text in frame1
        Label(self.frame1,
              text="Completed!! \n Do you want to EXIT?",
              font="Helvetica 10 bold").pack(side="bottom", anchor='center')

        # putting button in frame2
        self.b10 = Button(self.frame2,
                          text="Yes",
                          width=7,
                          state="active",
                          font='serif 10',
                          command=self.yes_clicked)
        self.b11 = Button(self.frame2,
                          text="No",
                          width=7,
                          state="active",
                          font='serif 10',
                          command=self.no_clicked)
        self.b10.pack(side="left", padx=8)
        self.b11.pack(side="left", padx=8)
        self.b10.bind('<Return>', self.yes_clicked)
        self.b11.bind('<Return>', self.no_clicked)

    def yes_clicked(self, *args):
        gbl.exit = 1
        self.quit()

    def no_clicked(self, *args):
        gbl.exit = 0
        self.quit()
    def initUI(self):
        self.parent.title("Minesweeper")
        s = Style()
        s.theme_use('classic')
        s.configure('TButton',
                    width=2,
                    padding=(0, 0, 0, 0),
                    background='#b9b9b9',
                    relief=tk.FLAT)
        s.map('TButton',
              background=[('disabled', '#555555'), ('pressed', '#777777'),
                          ('active', '#a8a8a8')])
        s.configure('Cleared.TButton', background='white')
        s.map('Cleared.TButton', background=[('active', 'white')])
        s.configure('Flagged.TButton', background='0066ff')
        s.map('Flagged.TButton', background=[('active', '#0044dd')])
        s.configure('Revealed.TButton', background='black')
        s.map('Revealed.TButton', background=[('active', 'black')])
        s.configure('Triggered.TButton', background='red')
        s.map('Triggered.TButton', background=[('active', 'red')])
        minefield = Minefield()
        self.__minefield = minefield

        # self.button_frame = Frame(self.parent)
        for i in range(minefield.get_row_count()):
            self.rowconfigure(i, pad=0)
        for i in range(minefield.get_column_count()):
            self.columnconfigure(i, pad=0)

        for row in range(minefield.get_row_count()):
            self.buttons.append(list())
            for column in range(minefield.get_column_count()):
                cell = minefield.get_cell([row, column])
                coordinates = cell.get_coordinates()
                button = Button(self, style='TButton')

                def run(event, self=self, internal_coordinates=coordinates):
                    return self.click_action(event, internal_coordinates)

                button.bind('<Button-1>', run)
                button.bind('<Button-2>', run)
                button.bind('<Button-3>', run)
                button.grid(row=row, column=column)
                self.buttons[row].append(button)

        self.pack()
Exemple #55
0
def styleNotebook(notebook):
    theme = "maeddlaevtabtheme"
    style = Style()

    # only create theme if not exists
    s = Style()
    if not theme in s.theme_names():
        style.theme_create( theme, parent="alt", settings={
            "TNotebook": {"configure": {"tabmargins": [2, 5, 2, 0], "background" : rootColor} },
            "TNotebook.Tab": {
                "configure": {"padding": [5, 1], "background": rootColor, 
                              "font" : ("Helvetica", 15, "bold") },
                "map":       {"background": [("selected", rootColor)] } } } )

    
    style.theme_use(theme)
    return notebook
Exemple #56
0
class Example(Frame):
    def __init__(self, parent):
        Frame.__init__(self, parent)

        self.parent = parent

        self.initUI()

    def initUI(self):

        self.parent.title("PyPass Manager by adb")
        self.style = Style()
        self.style.theme_use("clam")

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

        quitButton = Button(self, text="Exit", command=self.quit)
        quitButton.place(x=50, y=50)
Exemple #57
0
    def createWidgets(self, master):

        #-Set-progress-bar-style-for-custom-thickness--
        s = Style()
        s.theme_use("default")
        s.configure("TProgressbar", thickness=5)
        #----------------------------------------------

        master.grid_rowconfigure(0, weight=1)
        master.grid_columnconfigure(0, weight=1)

        # +++++++++++++++++++++++++++++++

        row = 0
        col = 0
        w = LabelFrame(master, text='Sample positioner status')
        w.grid(row=row, column=col, sticky=NSEW, padx=5, pady=5)
        self.populateDisplayPanel(w)
Exemple #58
0
class Example(Frame):
    def __init__(self, parent):
        Frame.__init__(self, parent)

        self.parent = parent

        self.initUI()

    def initUI(self):

        self.parent.title("Windows")
        self.style = Style()
        self.style.theme_use("default")
        self.pack(fill=BOTH, expand=1)

        self.columnconfigure(1, weight=1)
        self.columnconfigure(3, pad=7)
        self.rowconfigure(3, weight=1)
        self.rowconfigure(5, pad=7)

        lbl = Label(self, text="Windows")
        lbl.grid(sticky=W, pady=4, padx=5)

        area = Text(self)
        area.grid(row=1,
                  column=0,
                  columnspan=2,
                  rowspan=4,
                  padx=5,
                  sticky=E + W + S + N)

        abtn = Button(self, text="Activate")
        abtn.grid(row=1, column=3)

        cbtn = Button(self, text="Close")
        cbtn.grid(row=2, column=3, pady=4)

        hbtn = Button(self, text="Help")
        hbtn.grid(row=5, column=0, padx=5)

        obtn = Button(self, text="OK")
        obtn.grid(row=5, column=3)