Example #1
0
class TabServices(Frame):

    def __init__(self, parent, txt=dict()):
        """Instanciating the output workbook."""
        self.parent = parent
        Frame.__init__(self)

        # variables
        self.url_srv = StringVar(self,
                                 'http://suite.opengeo.org/geoserver/wfs?request=GetCapabilities')

        # widgets
        self.lb_url_srv = Label(self,
                                text='Web service URL GetCapabilities: ')
        self.ent_url_srv = Entry(self,
                                 width=75,
                                 textvariable=self.url_srv)
        self.btn_check_srv = Button(self, text="youhou")
        # widgets placement
        self.lb_url_srv.grid(row=0, column=0,
                             sticky="NSWE", padx=2, pady=2)
        self.ent_url_srv.grid(row=0, column=1,
                              sticky="NSWE", padx=2, pady=2)
        self.btn_check_srv.grid(row=0, column=2,
                                sticky="NSWE", padx=2, pady=2)
Example #2
0
    def _add_filename(self, frame, index, name, mode, option):
        if option:
            self.function[-1] = lambda v: [option, v]
        else:
            self.function[-1] = lambda v: [v]

        self.variables[-1] = StringVar()
        var = self.variables[-1]

        def set_name():
            if mode == "r":
                fn = tkFileDialog.askopenfilename(initialdir=".")
            else:
                fn = tkFileDialog.asksaveasfilename(initialdir=".")
            var.set(fn)

        label = Label(frame, text=name)
        label.grid(row=index, column=0, sticky="W", padx=10)

        field_button = Frame(frame)
        Grid.columnconfigure(field_button, 0, weight=1)

        field = Entry(field_button, textvariable=var)
        field.grid(row=0, column=0, sticky="WE")
        button = Button(field_button,
                        text="...",
                        command=set_name,
                        width=1,
                        padding=0)
        button.grid(row=0, column=1)

        field_button.grid(row=index, column=1, sticky="WE")
    def comboboxcallback(self, whichThread):
        if TkCmdFrm.comboVar[whichThread].get() == "Single Step":
            #Create a new button that is pulse
            tmpCnvs = Canvas(self.cmdFrm, width=100, height=40)
            tmpCnvs.grid(column=whichThread, row=2)
            tmpBtn = Button(self.cmdFrm,
                            text="Single Step",
                            command=lambda tmp=whichThread: self.toggle(tmp))
            tmpBtn.grid(column=whichThread, row=2, padx=4, pady=12)
            TkCmdFrm.toggleBtn[whichThread] = tmpBtn

            #Set the state variables
            TkCmdFrm.toggleState[whichThread] = False
            TkCmdFrm.threadSendStep[whichThread] = False
            TkCmdFrm.threadRun[whichThread] = False
            TkCmdFrm.btnCfgBitfield &= ~(1 << whichThread)
        else:
            #Create a new button that is toggle
            tmpCnvs = Canvas(self.cmdFrm, width=100, height=40)
            tmpCnvs.grid(column=whichThread, row=2)
            tmpBtn = Btn(self.cmdFrm,
                         text="Run",
                         command=lambda tmp=whichThread: self.toggle(tmp))
            tmpBtn.grid(column=whichThread, row=2, padx=8, pady=8)
            TkCmdFrm.toggleBtn[whichThread] = tmpBtn

            #Set the state variables
            TkCmdFrm.toggleState[whichThread] = False
            TkCmdFrm.threadSendStep[whichThread] = False
            TkCmdFrm.threadRun[whichThread] = True
            TkCmdFrm.btnCfgBitfield |= (1 << whichThread)
    def comboboxcallback(self, whichThread):
        if TkCmdFrm.comboVar[whichThread].get() == "Single Step":
            #Create a new button that is pulse
            tmpCnvs = Canvas(self.cmdFrm, width=100, height=40)
            tmpCnvs.grid(column = whichThread, row = 2)
            tmpBtn = Button(self.cmdFrm, text="Single Step", command=lambda tmp=whichThread: self.toggle(tmp))
            tmpBtn.grid(column = whichThread, row = 2, padx=4, pady=12)
            TkCmdFrm.toggleBtn[whichThread] = tmpBtn

            #Set the state variables            
            TkCmdFrm.toggleState[whichThread] = False
            TkCmdFrm.threadSendStep[whichThread] = False
            TkCmdFrm.threadRun[whichThread] = False
            TkCmdFrm.btnCfgBitfield &= ~(1 << whichThread)
        else:
            #Create a new button that is toggle
            tmpCnvs = Canvas(self.cmdFrm, width=100, height=40)
            tmpCnvs.grid(column = whichThread, row = 2)
            tmpBtn = Btn(self.cmdFrm, text="Run", command=lambda tmp=whichThread: self.toggle(tmp))
            tmpBtn.grid(column = whichThread, row = 2, padx=8, pady=8)
            TkCmdFrm.toggleBtn[whichThread] = tmpBtn
            
            #Set the state variables            
            TkCmdFrm.toggleState[whichThread] = False
            TkCmdFrm.threadSendStep[whichThread] = False
            TkCmdFrm.threadRun[whichThread] = True
            TkCmdFrm.btnCfgBitfield |= (1 << whichThread)
Example #5
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
Example #6
0
    def setup_widgets(self):
        """Five control widgets created along bottom"""

        # clear button
        clear_button = Button(self, text="Clear")
        clear_button.grid(row=3, column=1, padx=5, pady=5, sticky=W)
        clear_button.bind("<ButtonRelease-1>", self.clear_text)

        # Silent/Verbose select
        verbose_check = Checkbutton(self, text="Silent", \
            variable=self.verbose_flag, onvalue="-s", offvalue="")
        verbose_check.grid(row=3, column=2, padx=5, pady=5)

        # Analysis model menu
        choices2 = ['Select Model', 'model1', 'model2']
        om2 = OptionMenu(self, self.model, *choices2)  # pylint: disable=W0142
        om2.grid(row=3, column=3, padx=10, pady=20)

        # EMR Server Region menu
        choices = ['Select Region', 'Oregon', 'California', 'Virginia']
        om1 = OptionMenu(self, self.region, *choices)  # pylint: disable=W0142
        om1.grid(row=3, column=4, padx=10, pady=20)

        # Run EMR button
        emrbutton = Button(self, text="Run EMR")
        emrbutton.grid(row=3, column=5, padx=5, pady=5)
        emrbutton.bind("<ButtonRelease-1>", self.run_emr)
Example #7
0
    def initUI(self):

        self.parent.title("File dialog")

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

        fileMenu = Menu(menubar)
        fileMenu.add_command(label="Open", command=self.onOpen)
        menubar.add_cascade(label="File", menu=fileMenu)        
        self.style = Style()
        self.style.theme_use("default")        

        global frame1
        frame1 = Frame()
        frame1.grid(row=0, column=0, sticky='w')

        l1 = Label(frame1, text='CSV file name', relief=RIDGE, width=20)
        l1.grid(row=4, column=0)
        
        l2 = Label(frame1, text='SCR file name', relief=RIDGE, width=20)
        l2.grid(row=5, column=0)
        
        inform = Button(frame1, text="Choose CSV file", command=self.onCSVfile)
        inform.grid(row=1, column=0)

        self.file_opt = options = {}
        options['defaultextension'] = '.csv'
        options['filetypes'] = [('CSV files', '.csv'), ('all files', '.*')]
Example #8
0
class InfoFrame(Frame):
    def __init__(self, parent, question):
        Frame.__init__(self, parent)
        self.answer = StringVar()
        self.question = Label(self, text=question, style='Title.TLabel')
        self.question.grid(column=0, row=0, padx=10, pady=10, sticky='w')
        self.configure(background='yellow')
        self.question.configure(background='yellow')

        self.bar = Separator(self, orient=HORIZONTAL)
        self.bar.grid(column=0,
                      row=2,
                      columnspan=2,
                      padx=5,
                      pady=5,
                      sticky='nsew')

        self.ok = Button(self, text='OK', command=self.OkBut)
        self.ok.grid(column=0, row=3, padx=5, pady=5)

        self.grid()

        # Center the Window
        parent.update_idletasks()
        xp = (parent.winfo_screenwidth() / 2) - (self.winfo_width() / 2) - 8
        yp = (parent.winfo_screenheight() / 2) - (self.winfo_height() / 2) - 20
        parent.geometry('{0}x{1}+{2}+{3}'.format(self.winfo_width(),
                                                 self.winfo_height(), xp, yp))

        self.update()
        parent.mainloop()

    def OkBut(self):
        self.quit()
Example #9
0
    def comboboxcallback(self, bit):
        if self.indBitOptMenu[bit].get() == "Pulse":
            #Create a new button that is pulse
            tmpCnvs = Canvas(self.bitFrms[bit], width=100, height=40)
            tmpCnvs.grid(column=0, row=2, columnspan=2)
            tmpBtn = Button(self.bitFrms[bit],
                            text="SimSwitch",
                            command=lambda tmp=bit: self.toggle(tmp))
            tmpBtn.grid(column=0, row=2, columnspan=2, padx=4, pady=12)
            self.toggleBtn[bit] = tmpBtn

            #Set the state variables
            self.toggleState[bit] = False
            self.btnCfgBitfield &= ~(1 << bit)
            self.simSwitchBits &= ~(1 << bit)
        else:
            #Create a new button that is toggle
            tmpCnvs = Canvas(self.bitFrms[bit], width=100, height=40)
            tmpCnvs.grid(column=0, row=2, columnspan=2)
            tmpBtn = Btn(self.bitFrms[bit],
                         text="SimSwitch",
                         command=lambda tmp=bit: self.toggle(tmp))
            tmpBtn.grid(column=0, row=2, columnspan=2, padx=8, pady=8)
            self.toggleBtn[bit] = tmpBtn

            #Set the state variables
            self.btnCfgBitfield |= (1 << bit)
            if self.toggleState[bit]:
                self.simSwitchBits |= (1 << bit)
            else:
                self.simSwitchBits &= ~(1 << bit)
Example #10
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"})
Example #11
0
    def initUI(self):
        self.parent.title("Dat title")
        #self.style = Style()
        #self.style.theme_use("default")
        self.pack(fill=BOTH, expand=1)

        button = Button(self, text="Quit", command=self.quit)
        button.grid(row=4, column=1)

        button = Button(self, text="New Conversation")
        button.grid(row=0, column=0)
        button.bind('<Button-1>', self.onClickNewConv)

        self.listConv = Listbox(self)
        self.listConv.grid(row=1,column=0,rowspan=3,sticky=W+S+N+E)
        self.listConv.bind('<<ListboxSelect>>',self.onClickConv)

        self.text = Text(self)
        self.text.config(takefocus=False,wrap=WORD)
        self.text.tag_configure("red", background="#6666FF", foreground="#FFFFFF")
        self.text.tag_configure("blue", background="#0000FF", foreground="#FFFFFF")
        self.text.insert(END,"Retest\n")
        self.text.grid(row=0,column=1,rowspan=2,sticky=W+E+N+S)
        self.text.config(state=DISABLED)

        self.entry = Entry(self)
        self.entry.grid(row=3,column=1,sticky=W+E)
        self.entry.bind('<Return>', self.onReturnPressed)

        self.columnconfigure(0, weight=1)
        self.columnconfigure(1, weight=3)
        self.rowconfigure(1, weight=1)
Example #12
0
class PageThree(tk.Frame):
    def __init__(self, parent, controller):
        tk.Frame.__init__(self, parent)
        self.controller = controller

        Style().configure("TButton", padding=(0, 5, 0, 5), font='serif 10')

        self.columnconfigure(5, pad=5)
        '''''
        self.columnconfigure(1, pad=5)
        self.columnconfigure(2, pad=5)
        self.columnconfigure(3, pad=5)
        self.columnconfigure(4, pad=5)
          self.rowconfigure(0, pad=15)
        self.rowconfigure(1, pad=15)
        self.rowconfigure(2, pad=15)
        self.rowconfigure(3, pad=15)
        self.rowconfigure(4, pad=15)
        self.rowconfigure(18, pad=15)
        self.rowconfigure(46, pad=15)""""""
        '''
        imagehead = Image.open("bfs_dfs.png")
        tkimage = ImageTk.PhotoImage(imagehead)
        self.tkimage = tkimage
        panel1 = Label(self, image=tkimage, width=650, height=500)
        panel1.grid(row=10, column=0, sticky=E)
        # for two big textboxes

        self.tb8 = Text(self, width=55, height=8, font=("Helvetica", 11), wrap=WORD)
        self.tb8.grid(row=10, column=20, columnspan=2, sticky=W)

        # forsmall two textboxes
        self.tb1 = Text(self, width=30, height=5)
        self.tb1.grid(row=0, column=0, sticky=W)
        self.tb1.insert(0.0, "insert goal state assuming start node is 0")
        # self.tb2 = Text(self, width=30, height=5)
        # self.tb2.insert(0.0, "insert goal state")
        # self.tb2.grid(row=0, column=1, sticky=W)

        # buttons
        self.hbtn = Button(self, text="BACK", command=lambda: controller.show_frame("StartPage"))
        self.hbtn.grid(row=1, column=0, columnspan=2, sticky=W)

        self.obtn = Button(self, text="SUBMIT", command=lambda: self.info())
        self.obtn.grid(row=1, column=1, columnspan=2, sticky=W)

    def info(self):
        # print(val)
        point1 = self.tb1.get("1.0", "end-1c")

        point1 = int(point1)
        x = dfs.start(point1)

        self.tb8.configure(state=NORMAL)

        self.tb8.delete(1.0, END)

        self.tb8.insert(0.0, x)

        self.tb8.configure(state=DISABLED)
Example #13
0
    def comboboxcallback(self, bit):
        if self.indBitOptMenu[bit].get() == "Pulse":
            #Create a new button that is pulse
            tmpCnvs = Canvas(self.bitFrms[bit], width=100, height=40)
            tmpCnvs.grid(column = 0, row = 2, columnspan = 2)
            tmpBtn = Button(self.bitFrms[bit], text="SimSwitch", command=lambda tmp=bit: self.toggle(tmp))
            tmpBtn.grid(column = 0, row = 2, columnspan = 2, padx=4, pady=12)
            self.toggleBtn[bit] = tmpBtn

            #Set the state variables            
            self.toggleState[bit] = False
            self.btnCfgBitfield &= ~(1 << bit)
            self.simSwitchBits &= ~(1 << bit)
        else:
            #Create a new button that is toggle
            tmpCnvs = Canvas(self.bitFrms[bit], width=100, height=40)
            tmpCnvs.grid(column = 0, row = 2, columnspan = 2)
            tmpBtn = Btn(self.bitFrms[bit], text="SimSwitch", command=lambda tmp=bit: self.toggle(tmp))
            tmpBtn.grid(column = 0, row = 2, columnspan = 2, padx=8, pady=8)
            self.toggleBtn[bit] = tmpBtn
            
            #Set the state variables            
            self.btnCfgBitfield |= (1 << bit)
            if self.toggleState[bit]:
                self.simSwitchBits |= (1 << bit)
            else:
                self.simSwitchBits &= ~(1 << bit)
 def createConfirmWin(self):
     newWin = Toplevel(self)
     agree = Button(newWin, text = "Yes", command = self.onDelete)
     deny = Button(newWin, text = "No", command = lambda: newWin.destroy())
     label = Label(newWin, text = "Are you sure you want to delete all reminders?")
     label.grid(row = 0, column = 0)
     agree.grid(row = 0, column = 1)
     deny.grid(row = 0, column = 2)
    def __draw_new_draft_window(self, parent):

        self.parent.title("New Draft")

        style = StringVar()
        style.set("Snake")

        opponent_label = Label(parent, text="Opponents")
        opponent_entry = Entry(parent, width=5)
        
        position_label = Label(parent, text="Draft Position")
        position_entry = Entry(parent, width=5)
        
        rounds_label = Label(parent, text="Number of Rounds")
        rounds_entry = Entry(parent, width=5)
        
        style_label = Label(parent, text="Draft Style")
        style_menu = OptionMenu(parent, style, "Snake", "Linear")
        
        def begin_draft():
            """
            initializes variables to control the flow of the draft
            calls the first window of the draft.
            """
            self.game.number_of_opponents = int(opponent_entry.get())
            self.game.draft_position = int(position_entry.get())
            self.game.number_of_rounds = int(rounds_entry.get())
            self.game.draft_style = style.get()
            
            self.game.opponents = []
            self.game.current_position = 1
            self.game.current_round = 1
            
            for x in xrange(self.game.number_of_opponents):
                self.game.opponents.append(Opponent.Opponent(x))

            if self.game.draft_position <= self.game.number_of_opponents + 1:
                MainUI(self.parent, self.game)
            else:
                tkMessageBox.showinfo("Error",
                                      "Draft position too high!\nYou would never get to pick a player"
                                      )

        def begin_button(event):
            begin_draft()

        ok_button = Button(parent, text="OK", command=begin_draft)
        self.parent.bind("<Return>", begin_button)
        
        opponent_label.grid(row=0, pady=5)
        opponent_entry.grid(row=0, column=1, pady=5)
        position_label.grid(row=1)
        position_entry.grid(row=1, column=1)
        rounds_label.grid(row=2, pady=5)
        rounds_entry.grid(row=2, column=1, pady=5, padx=5)
        style_label.grid(row=3)
        style_menu.grid(row=3, column=1)
        ok_button.grid(row=4, column=1, sticky="se", pady=5, padx=5)
Example #16
0
    def initUI(self):
      
        self.parent.title("Add Food")
        self.style = Style()
        self.style.theme_use("default")
        self.grid()

        l_name = Label(self.parent, text="Name")
        l_day = Label(self.parent, text="Day")
        l_month = Label(self.parent, text="Month")
        l_year = Label(self.parent, text="Year")

        l_name.grid(row=0, column=3)
        l_day.grid(row=0, column=0)
        l_month.grid(row=0, column=1)
        l_year.grid(row=0, column=2)

        days = []
        months = []
        years = []


        days.extend(range(1, 32))
        months.extend(range(1, 13))
        years.extend(range(2015, 2036))

        days = map(str, days)
        months = map(str, months)
        years = map(str, years)

        self.var_day = StringVar(self.parent)
        self.var_month = StringVar(self.parent)
        self.var_year = StringVar(self.parent)
        self.var_name = StringVar(self.parent)

        self.var_day.set(days[0])
        self.var_month.set(months[0])
        self.var_year.set(years[0])

        f_name = Entry(self.parent, textvariable=self.var_name)
        f_day = apply(OptionMenu, (self.parent, self.var_day) + tuple(days))
        f_month = apply(OptionMenu, (self.parent, self.var_month) +\
            tuple(months))
        f_year = apply(OptionMenu, (self.parent, self.var_year) +\
            tuple(years))

        f_name.grid(row=1, column=3)		
        f_day.grid(row=1, column=0)
        f_month.grid(row=1, column=1)
        f_year.grid(row=1, column=2)


        add_btn = Button(self.parent, text="Add Food", command=self.add_food)
        add_btn.grid(row=0, column=5)

        cancel_btn = Button(self.parent, text="Cancel",\
            command=self.cancel_food)
        cancel_btn.grid(row=1, column=5)
Example #17
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)
	def add_file_browser(self, f, button_txt, init_txt , r, c, help_txt=''):
		b = Button(f,text=button_txt)
		b.grid(row=r, column=c, sticky=W+E)
		f_var = StringVar()
		f_var.set(init_txt)
		e = Entry(f, textvariable=f_var)
		e.grid(row=r, column=c+1)
		b.configure(command=lambda: self.browse_file(f_var, b))
		return f_var
	def setup_query_segment(self):
		'''set up SPARQL query segment'''
		dct = self.user_input

		# dct['out_dir'] = self.button_component('Browse', 'N/A', 0, 0, mode=DISABLED)

		sparql_btn = Button(self,text='Execute SPARQL Enrichment')
		sparql_btn.grid(row=4, column=0, columnspan=2, sticky=W)
		sparql_btn.configure(command=lambda : self.sparql_extraction(sparql_btn))
Example #20
0
class GUI(Frame):
    def __init__(self, master=None, **kw):
        Frame.__init__(self, master, **kw)
        self.initialize()

    def initialize(self):
        self.master.title(settings.APP_TITLE)

        self.pack(fill=Tkinter.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="Журнал")
        lbl.grid(sticky=Tkinter.W, pady=4, padx=5)

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

        self.widgetLogger = WidgetLogger(self.area)

        lbl = Label(self, text="Адрес репозитория: ")
        lbl.grid(row=6)

        self.repo_addr_str = Tkinter.StringVar()
        self.repo_addr = Tkinter.Entry(self, textvariable=self.repo_addr_str)
        self.repo_addr.grid(row=7)

        lbl = Label(self, text="FTP для размещения: ")
        lbl.grid(row=6, column=1)

        self.ftp_addr_str = Tkinter.StringVar()
        self.ftp_addr = Tkinter.Entry(self, textvariable=self.ftp_addr_str)
        self.ftp_addr.grid(row=7, column=1, pady=1)

        self.deploybtn = Button(self,
                                text="Начать обновление",
                                command=self.start_update_thread)
        self.deploybtn.grid(row=10)

    def start_update_thread(self):
        # resetting vars
        settings.DEFAULT_FTP_HOST = self.ftp_addr_str.get()
        settings.DEFAULT_GIT_REPO = self.repo_addr_str.get()

        self.deploybtn.config(text="Идет обновление...",
                              state=Tkinter.DISABLED)

        tr = Thread(target=lambda: full_cycle(self))
        tr.start()
Example #21
0
 def add_file_browser(self, f, button_txt, init_txt, r, c, help_txt=''):
     b = Button(f, text=button_txt)
     b.grid(row=r, column=c, sticky=W + E)
     f_var = StringVar()
     f_var.set(init_txt)
     e = Entry(f, textvariable=f_var)
     e.grid(row=r, column=c + 1)
     b.configure(command=lambda: self.browse_file(f_var, b))
     return f_var
Example #22
0
	def initUI(self, peakData, callback):

		self.parent.title("Calibrate energy to peaks")

		Style().configure("TButton", padding=(0, 5, 0, 5), 
			font='serif 10')

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

		rowNb = 0
		count = 0
		self.energyEntries = []
		self.energyErrEntries = []
		self.peakData = peakData
		self.callback = callback
		for rowNb in range(0,len(self.peakData)): #why not just iterate over fitData instead of over a range? Because we want to be sure of the ordering for adding energy levels later
			dataRow = self.peakData[rowNb]

			self.rowconfigure(count, pad=3)
			label = Label(self, text="Peak {0}".format(rowNb+1))
			label.grid(row=count, column=0, columnspan=4)
			count = count + 1

			self.rowconfigure(count, pad=3)
			label = Label(self, text='Peak')
			label.grid(row=count, column=0)
			label = Label(self, text=dataRow['Peak'])
			label.grid(row=count, column=1)
			label = Label(self, text='Err')
			label.grid(row=count, column=2)
			label = Label(self, text=dataRow['PeakErr'])
			label.grid(row=count, column=3)
			count = count + 1

			self.rowconfigure(count, pad=3)
			label = Label(self, text='Energy')
			label.grid(row=count, column=0)
			entryEnergy = Entry(self)
			entryEnergy.grid(row=count, column=1)
			label = Label(self, text='Err')
			label.grid(row=count, column=2)
			entryError = Entry(self)
			entryError.grid(row=count, column=3)
			count = count + 1

			self.energyEntries.append(entryEnergy)
			self.energyErrEntries.append(entryError)

		self.parent.bind("<Return>", self.buttonCallback)
		self.parent.bind("<KP_Enter>", self.buttonCallback)
		run = Button(self, text="Process calibration", command=self.buttonCallback)
		run.grid(row=count, column=0)
		count = count + 1
		self.pack()
Example #23
0
 def cmdPanel(self):
     tmpFrm = Frame(self.bgndFrm, borderwidth=5, relief=RAISED)
     tmpFrm.grid()
     tmpFrm.grid(column=0, row=0)
     tmpBtn = Button(tmpFrm,
                     width=12,
                     text="Close",
                     command=self.closeBtnPress)
     tmpBtn.grid(column=0, row=0, padx=4, pady=8)
Example #24
0
 def enter(self, something):
     if self.index.get() is "":
         print "No valid action selected"
         return
     self.parent.i = self.actions.index(self.index.get())
     self.load = self.parent.link.getItem(
         self.actions.index(self.index.get()))
     enter = Button(self, text="Edit", command=self.changeFrame)
     enter.grid(row=0, column=1)
	def setup_launcher(self):
		'''create buttons to execute the job and for default values'''

		def_button = Button(self,text='Defaults')
		def_button.grid(row=30, column=0, padx=5, pady=5, sticky=W)
		def_button.configure(command=self.defaults)

		go_button = Button(self,text="Run!")
		go_button.grid(row=30, column=1, padx=5, pady=5, sticky=E)
		go_button.configure(command=lambda: self.go(go_button))
Example #26
0
    def setup_launcher(self):
        '''create buttons to execute the job and for default values'''

        def_button = Button(self, text='Defaults')
        def_button.grid(row=30, column=0, padx=5, pady=5, sticky=W)
        def_button.configure(command=self.defaults)

        go_button = Button(self, text="Run!")
        go_button.grid(row=30, column=1, padx=5, pady=5, sticky=E)
        go_button.configure(command=lambda: self.go(go_button))
Example #27
0
    def setup_query_segment(self):
        '''set up SPARQL query segment'''
        dct = self.user_input

        # dct['out_dir'] = self.button_component('Browse', 'N/A', 0, 0, mode=DISABLED)

        sparql_btn = Button(self, text='Execute SPARQL Enrichment')
        sparql_btn.grid(row=4, column=0, columnspan=2, sticky=W)
        sparql_btn.configure(
            command=lambda: self.sparql_extraction(sparql_btn))
	def button_component(self, button_txt, init_txt, r, c, help_txt='', mode=NORMAL):
		'''adds a button component associated with an entry (the label only activates when help_txt != '')'''
		b = Button(self, text=button_txt)
		b.grid(row=r, column=c, sticky=W+E)
		b.config(state=mode)
		dir_var = StringVar()
		dir_var.set(init_txt)
		Entry(self, textvariable=dir_var).grid(row=r, column=c+1)
		Label(self, text=help_txt).grid(row=r, column=c+2, sticky=W)
		b.configure(command=lambda: self.browse_dir(dir_var, b))
		return dir_var
 def createSleepWin(self):
     newWin = Toplevel(self)
     newWin.title("Sleep time")
     self.sleepSlider = Scale(newWin,length = 300, orient = 'horizontal', from_=0, to_=120)
     sleepLabel = Label(newWin, text = "Set when you want to be reminded again(seconds):")
     sleepButton2 = Button(newWin, text = "Sleep now!", command = self.onSleep)
     closeWin = Button(newWin, text = "Close", command = lambda: newWin.destroy())
     closeWin.grid(row = 2, column = 0)
     sleepLabel.grid(row = 0, column = 0)
     self.sleepSlider.grid(row = 1, column = 0)
     sleepButton2.grid(row = 0, column = 1)
class IPSettingsDialog(object, Dialog):
    def __init__(self, parent, settings, title):
        self.settings = settings
        Dialog.__init__(self, parent, title)

    def body(self, parent):
        self.tkVar = IntVar()
        self.tkVar.set(-1)
        tkRb1 = Radiobutton(parent,
                            text="QT Console",
                            variable=self.tkVar,
                            value=0,
                            command=self.radio_select)
        tkRb1.grid(row=0)
        tkRb2 = Radiobutton(parent,
                            text="Notebook",
                            variable=self.tkVar,
                            value=1,
                            command=self.radio_select)
        tkRb2.grid(row=1)

        self.tkDir = StringVar()
        self.tkDir.set(self.settings.notebook_dir)
        self.tkDirEntry = Entry(parent,
                                textvariable=self.tkDir,
                                state="disabled")
        self.tkDirEntry.grid(row=2, column=0)
        self.tkBrowseButton = Button(parent,
                                     text="Browse",
                                     state="disabled",
                                     command=self.get_directory)
        self.tkBrowseButton.grid(row=2, column=1)

    def apply(self):
        rad = int(self.tkVar.get())
        note_dir = str(self.tkDir.get())
        self.result = rad, note_dir

    def radio_select(self):
        if self.tkVar.get() == 1:
            self.tkDirEntry.config(state="normal")
            self.tkBrowseButton.config(state="normal")
        else:
            self.tkDirEntry.config(state="disabled")
            self.tkBrowseButton.config(state="disabled")

    def get_directory(self):
        options = {
            'mustexist': True,
            'title': 'Please select a directory for IPython notebooks'
        }
        folder_path = tkFileDialog.askdirectory(**options)
        self.tkDir.set(folder_path)
Example #31
0
    def initUI(self):
        self.parent.title('Prepare DWI')
        frm_output = Frame(self)
        frm_button = Frame(self)
        frm_list = VerticalScrolledFrame(self)
        self.frm_list_sub = frm_list.interior

        self.lst_dwi = self.List_DWI(self, self.frm_list_sub)

        i = 0
        frm_output.grid(row=i, column=0, columnspan=6, sticky=EW)
        frm_output.grid_columnconfigure(1, weight=1)
        ii  = 0; Label(frm_output, text='Subject').grid(row=ii, column=0)
        self.txt_subject = Entry(frm_output); self.txt_subject.grid(row=ii, column=1, sticky=EW)
        self.txt_subject.insert(0, self.subject_name)
        ii += 1; Label(frm_output, text='Output Directory').grid(row=ii, column=0)
        self.txt_output = Entry(frm_output); self.txt_output.grid(row=ii, column=1, sticky=EW)
        self.txt_output.insert(0, self.output_dir)
        btn_output = Button(frm_output, text='...', command=lambda:dirnameDialog_text(self.txt_output)); btn_output.grid(row=ii, column=2)
        ii += 1; Label(frm_output, text='Merged B0').grid(row=ii, column=0)
        self.txt_output_b0 = Entry(frm_output); self.txt_output_b0.grid(row=ii, column=1, sticky=EW)
        btn_output_b0 = Button(frm_output, text='Gen', command=lambda:self.lst_dwi.fn_b0(self.txt_output_b0)); btn_output_b0.grid(row=ii, column=2)
        ii += 1; Label(frm_output, text='Merged DWI').grid(row=ii, column=0)
        self.txt_output_dw = Entry(frm_output); self.txt_output_dw.grid(row=ii, column=1, sticky=EW)
        btn_output_dw = Button(frm_output, text='Gen', command=lambda:self.lst_dwi.fn_dw(self.txt_output_dw)); btn_output_dw.grid(row=ii, column=2)

        i += ii
        i += 1
        frm_button.grid(row=i, column=0, columnspan=6, sticky=EW)

        ii = 0
        btn_add = Button(frm_button, text='ADD Nifti1 file', command=self.add_dwi_list); btn_add.grid(row=ii, column=0)
        btn_run = Button(frm_button, text='Run', command=self.run); btn_run.grid(row=ii, column=1)

        i += ii
        i += 1
        i_frm_list = i

        self.frm_list_sub.grid_columnconfigure(2, weight=1)
        frm_list.grid(row=i, column=0, columnspan=6, sticky=NSEW)
        self.grid_rowconfigure(i_frm_list, weight=1, minsize=20)

        #self.lst_dwi.add_one('test1')
        #self.lst_dwi.add_one('test2')


        self.grid_columnconfigure(0, weight=1)

        ni = i + 1
        #for i in range(i_frm_list, ni):
        #    self.grid_rowconfigure(i, weight=1, minsize=20)

        self.pack(fill=BOTH, expand=True)
Example #32
0
 def initPopup(self):
     self.var1 = IntVar()
     cb = Checkbutton(self, text=str("Osteolysis"), variable=self.var1)
     cb.grid(row=0, column=0, padx=15, pady=20, sticky=E)
     self.var2 = IntVar()
     cb = Checkbutton(self, text=str("Synovitis"), variable=self.var2)
     cb.grid(row=0, column=1, pady=20, sticky=W)
      
     printButton = Button(self, text="Submit", command=self.setVars)
     printButton.grid(row=1, column=0, padx=15, sticky=E)
     printButton = Button(self, text="Close", command=self.destroy)
     printButton.grid(row=1, column=1, sticky=W)
Example #33
0
class StatusFrame(Frame):
    def __init__(self, parent, passfail, failtext):
        Frame.__init__(self, parent)
        self.status = StringVar()
        self.status_text = StringVar()

        self.statuslbl = Label(self, textvariable=self.status, style='Title.TLabel'); self.statuslbl.grid(column=0, row=1, columnspan=2, padx=100, pady=10)

        self.bar = Separator(self, orient=HORIZONTAL); self.bar.grid(column=0, row=2, columnspan=2, padx=5, pady=5, sticky='nsew')

        self.ok = Button(self, text='OK',  command=self.OkBut, width=10); self.ok.grid(column=0, columnspan=2, row=4, padx=5, pady=5)

        if passfail == 'PASS':
            self.TestPassed()
        elif passfail == 'FAIL':
            self.TestFailed(failtext)
        else:
            self.status.set('What?????')
            
        self.grid()

        # Center the Window
        parent.update_idletasks()
        
        xp = (parent.winfo_screenwidth() / 2) - (self.winfo_width() / 2) - 8
        yp = (parent.winfo_screenheight() / 2) - (self.winfo_height() / 2) - 20
        parent.geometry('{0}x{1}+{2}+{3}'.format(self.winfo_width(), self.winfo_height(), xp, yp))

        parent.mainloop()

    def OkBut(self):
        self.quit()

    def StatusText(self, text ):
        self.status_text.set(text)
        

    def TestInProgress(self):
        self.status.set('Test In Progress')
        self.statuslbl.configure(foreground='black')
        
    def TestPassed(self):         
        self.status.set('Test PASSED')
        self.configure(background='green')
        self.statuslbl.configure(background='green',foreground='yellow')
        
    def TestFailed(self, text):         
        self.status.set('Test FAIL')
        self.configure(background='red')
        self.statuslbl.configure(background='red',foreground='yellow')
        self.text = Text( self, relief=SUNKEN, width=110, height=16); self.text.grid(column=0, row=3, columnspan=2, sticky='nsew', padx=10, pady=10)
        self.text.insert(INSERT,text)
    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)
Example #35
0
    def loginInit(self):
        self.parent.title("Password Keeper")
        Style().configure("Tlabel",font="Times")

        lbusr = Label(self,text="Master Username")
        lbusr.grid(row=0,column=0)
        lbps = Label(self,text="Master Password")
        lbps.grid(row=1,column=0)

        enusr = Entry(self)
        enusr.grid(row=0,column=1)
        enps = Entry(self)
        enps.grid(row=1,column=1)

        def login():
            credict = {}
            with open("cred.json","rb") as f:
                credict = json.load(f)

            for key in credict:
                if key == enusr.get() and credict[key] == enps.get():
                    switch()
                elif key != enusr.get() and credict[key] == enps.get():
                    tkMessageBox.showinfo(title=None,message="Wrong Username! Please Re-enter")
                    enusr.delete(0, Tkinter.END)
                    enps.delete(0, Tkinter.END)
                    break
                elif key == enusr.get() and credict[key] != enps.get():
                    tkMessageBox.showinfo(title=None,message="Wrong password! Please Re-enter.")
                    enusr.delete(0, Tkinter.END)
                    enps.delete(0, Tkinter.END)
                    break
                else:
                    tkMessageBox.showinfo(title=None,message="Username/Password combination is wrong! Please Re-enter")
                    enusr.delete(0, Tkinter.END)
                    enps.delete(0, Tkinter.END)
                    break

        def switch():
            self.parent.destroy()
            root = Tk()
            Primary(root,self.dict,self.enlist)
            root.mainloop()

        reg = Button(self,text="New User",command=self.register)
        reg.grid(row=2,column=0,sticky=W+E)
        lgn = Button(self,text="Login",command=login)
        lgn.grid(row=2,column=1,sticky=W+E)

        self.pack()
Example #36
0
    def init_ui(self):
        self.rowconfigure(3, weight=1)
        self.columnconfigure(0, weight=1)
        self.button_load_type = Button(self, text="Load Type JSON", command=lambda: browse_file(self, 1, ))
        self.button_load_type.grid(
            row=0, columnspan=2, sticky=W + E, pady=4, padx=5)
        self.button_load_color = Button(
            self, text="Load Color JSON", command=lambda: browse_file(self, 2))
        self.button_load_color.grid(
            row=1, columnspan=2, sticky=W + E, pady=4, padx=5)
        button_load = Button(
            self, text="Load Images", command=lambda: browse_images(self))
        button_load.grid(row=2, columnspan=2, sticky=W + E, pady=4, padx=5)
        button_learn = Button(
            self,
            text="Test",
            command=
            lambda: start_testing(self.dtype, self.dcolor, self.picture_frames)
        )
        button_learn.grid(row=4, columnspan=2, sticky=W + E, pady=4, padx=5)

        canvas = Canvas(self)
        canvas.grid(row=3, sticky=W + E + N + S, column=0, pady=4, padx=5)

        frame = self.picture_frame = Frame(canvas)
        canvas.create_window(0, 0, window=frame, anchor='nw')

        scroll_bar = Scrollbar(self, orient="vertical", command=canvas.yview)
        scroll_bar.grid(sticky=E + N + S, padx=5, row=3, column=1)

        canvas.configure(yscrollcommand=scroll_bar.set)

        # track changes to the canvas and frame width and sync them,
        # also updating the scrollbar
        def _configure_interior(event):
            # update the scrollbars to match the size of the inner frame
            size = (frame.winfo_reqwidth(), frame.winfo_reqheight())
            canvas.config(scrollregion="0 0 %s %s" % size)
            if frame.winfo_reqwidth() != canvas.winfo_width():
                # update the canvas's width to fit the inner frame
                canvas.config(width=frame.winfo_reqwidth())

        frame.bind('<Configure>', _configure_interior)

        def _configure_canvas(event):
            if frame.winfo_reqwidth() != canvas.winfo_width():
                # update the inner frame's width to fill the canvas
                canvas.itemconfigure(frame, width=canvas.winfo_width())

        canvas.bind('<Configure>', _configure_canvas)
Example #37
0
class GUI(Frame):
    def __init__(self, master=None, **kw):
        Frame.__init__(self, master, **kw)
        self.initialize()

    def initialize(self):
        self.master.title(settings.APP_TITLE)

        self.pack(fill=Tkinter.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="Журнал")
        lbl.grid(sticky=Tkinter.W, pady=4, padx=5)

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

        self.widgetLogger = WidgetLogger(self.area)

        lbl = Label(self, text="Адрес репозитория: ")
        lbl.grid(row=6)

        self.repo_addr_str = Tkinter.StringVar()
        self.repo_addr = Tkinter.Entry(self, textvariable=self.repo_addr_str)
        self.repo_addr.grid(row=7)

        lbl = Label(self, text="FTP для размещения: ")
        lbl.grid(row=6, column=1)

        self.ftp_addr_str = Tkinter.StringVar()
        self.ftp_addr = Tkinter.Entry(self, textvariable=self.ftp_addr_str)
        self.ftp_addr.grid(row=7, column=1, pady=1)

        self.deploybtn = Button(self, text="Начать обновление", command=self.start_update_thread)
        self.deploybtn.grid(row=10)

    def start_update_thread(self):
        # resetting vars
        settings.DEFAULT_FTP_HOST = self.ftp_addr_str.get()
        settings.DEFAULT_GIT_REPO = self.repo_addr_str.get()

        self.deploybtn.config(text="Идет обновление...", state=Tkinter.DISABLED)

        tr = Thread(target=lambda: full_cycle(self))
        tr.start()
Example #38
0
    def onQuest(self):
        global buttonVX
        def onbuttonOk():
	    output = subprocess.Popen("./menue.sh A",shell=True) 
            tkFensterFehler.destroy()    
        def onbuttonXk():
            output = subprocess.Popen("./menue.sh B",shell=True)  
            tkFensterFehler.destroy()    
        def onbuttonVX():
	    output = subprocess.Popen("./menue.sh C",shell=True)  
            tkFensterFehler.destroy()    
        def onbuttonWX():
            output = subprocess.Popen("./menue.sh D",shell=True)  
            tkFensterFehler.destroy()    
            
######### open sencond window                     

        tkFensterFehler = Toplevel()
        tkFensterFehler.title('Lichtschalter')
        tkFensterFehler.geometry('300x100+200+300')
        
        
################ button second window

        buttonOk = Button(master=tkFensterFehler, text='Lichtschalter 1 an', command=onbuttonOk)
	buttonOk.grid(row=0, column=0)

        buttonXk = Button(master=tkFensterFehler, text='Lichtschalter 1 aus', command=onbuttonXk)
	buttonXk.grid(row=1, column=0)
	
	buttonXk1 = Button(master=tkFensterFehler, text='Lichtschalter 2 an', command=onbuttonVX)
	buttonXk1.grid(row=0, column=1)
	
	buttonXk2 = Button(master=tkFensterFehler, text='Lichtschalter 2 aus', command=onbuttonWX)
	buttonXk2.grid(row=1, column=1)
Example #39
0
    def initUI(self):
      
        self.parent.title("Food List Editor")
        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(4, weight=1)
        self.rowconfigure(5, pad=7)
        
        lbl = Label(self, text="Food List")
        lbl.grid(sticky=W, pady=4, padx=5)
                
        abtn = Button(self, text="Add Food", command=self.sequence)
        abtn.grid(row=1, column=3)

        dbtn = Button(self, text="Delete Food", command=self.delete_food)
        dbtn.grid(row=2, column=3, pady=4)
		
        upbtn = Button(self, text="Refresh", command=self.update_list)
        upbtn.grid(row=3, column=3)

        cbtn = Button(self, text="Close", command=self.close_program)
        cbtn.grid(row=5, column=3)

        scrollbar = Scrollbar(self, orient="vertical")
        self.lb = Listbox(self, width=50, height=20,\
            yscrollcommand=scrollbar.set)
        scrollbar.config(command=self.lb.yview)

        self.make_list()
Example #40
0
    def initUI(self):
        self.title("Social Link Creator")

        Style().configure("TButton",
                          padding=(0, 5, 0, 5),
                          background='WhiteSmoke')

        #simulate = Button(self, text="Simulate", command=self.simulate)
        #simulate.grid(row=2, column=3)

        back = Button(self, text="Back to Arcana selection", command=self.back)
        back.grid(row=2, column=2)

        SLBase(self)
Example #41
0
    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)
Example #42
0
    def initUI(self):
        self.parent.title("Windows")
        self.pack(fill=BOTH, expand=True)

        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)
    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()
Example #44
0
    def initUI(self):
        global init
        self.parent.title("Mavric Hip GUI")
        self.style = Style()
        self.style.theme_use("default")
        self.pack()
        
        #Initialize figure
        fig = matplotlib.figure.Figure()
        ax = fig.add_subplot(111)
        self.thisImg = np.eye(512, 512)
        self.figDrawing = ax.imshow(self.thisImg, cmap='gray')
        self.canvas=FigureCanvasTkAgg(fig,master=self)
        self.canvas.show()
        self.canvas.get_tk_widget().configure(takefocus=True)
        self.canvas.get_tk_widget().grid(row=0, column=1, columnspan=2, rowspan=1)
        
        #Reset the focus to the dicom images
        self.canvas.mpl_connect('button_press_event', lambda event:self.canvas._tkcanvas.focus_set())
        #Watch for mouse or key press events
        self.canvas.mpl_connect('button_press_event',self.selectRoi)
        self.canvas.mpl_connect('button_press_event', lambda event: PopUp())
        self.canvas.mpl_connect('key_press_event',self.writeRoi)
        #Load the buttons
        nextButton = Button(self, text="<", command=self.prev)
        nextButton.grid(row=0, column=0)
        
        openButton = Button(self, text="Open", command=self.pickFile)
        openButton.grid(row=2, column=1, sticky=E)
 
        quitButton = Button(self, text="Quit", command=self.quit)
        quitButton.grid(row=2, column=2, sticky=W)
        
        nextButton = Button(self, text=">", command=self.next)
        nextButton.grid(row=0, column=3)
Example #45
0
    def initUI(self):
        self.parent.title("Windows")
        self.pack(fill=BOTH, expand=True)

        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)

        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)
Example #46
0
    def initUI(self):
        self.parent.title("Story Creator")
        self.grid(row=0, column=0)

        Style().configure("TButton", padding=(0, 5, 0, 5), background='black')

        #logo = ImageTk.PhotoImage(Image.open(json_reader.buildPath("creator_logo.png")))
        #logolabel = Label(self, image=logo, bg='black')
        #logolabel.image = logo
        #logolabel.grid(row=0, column=0)

        intframe = Frame(self)
        intframe.configure(bg='black')
        intframe.grid(row=0, column=1)

        createSL = Button(intframe,
                          text="Create Social Link",
                          command=self.actionS)
        createSL.grid(row=0, column=0)

        createPersona = Button(intframe,
                               text="Create Persona",
                               command=self.actionP)
        createPersona.grid(row=1, column=0)

        createChar = Button(intframe,
                            text="Create Character",
                            command=self.actionC)
        createChar.grid(row=2, column=0)

        quit = Button(intframe, text="Quit", command=self.quit)
        quit.grid(row=3, column=0)
Example #47
0
    def initUI(self):

        self.parent.title("AUTO TIPS")
        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="Status")
        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="Drive Command", command=win3)
        abtn.grid(row=1, column=3)

        cbtn = Button(self, text="Tester Manual Control", command=win2)
        cbtn.grid(row=2, column=3, pady=4)

        dbtn = Button(self, text="Auto Run", command=AutoTIPS)
        dbtn.grid(row=3, column=3, pady=4)

        obtn = Button(self, text="OK", command=self.parent.destroy)
        obtn.grid(row=5, column=3)
Example #48
0
    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)
Example #49
0
	def initUI(self, parameterDict, callback, validate, undoCallback):

		self.parent.title("Choose parameters for fit")

		Style().configure("TButton", padding=(0, 5, 0, 5), 
			font='serif 10')

		self.columnconfigure(0, pad=3)
		self.columnconfigure(1, pad=3)

		count = 0
		entries = {}
		for key, value in parameterDict.iteritems():
			self.rowconfigure(count, pad=3)
			label = Label(self, text=key)
			label.grid(row=count, column=0)
			entry = Entry(self)
			entry.grid(row=count, column=1)
			entry.insert(0, value)
			entries[key] = entry
			count = count + 1

		def buttonCallback(*args): #the *args here is needed because the Button needs a function without an argument and the callback for function takes an event as argument
			try:
				newParameterDict = {}
				for key, value in entries.iteritems():
					newParameterDict[key] = value.get()
				self.parent.withdraw() #hide window
				feedback = callback(newParameterDict)
				if validate:
					if(askyesno("Validate", feedback,  default=YES)):
						self.parent.destroy() #clean up window
					else:
						undoCallback() #rollback changes done by callback
						self.parent.deiconify() #show the window again
				else:
					self.parent.withdraw()
					self.parent.destroy()
			except Exception as e:
				import traceback
				traceback.print_exc()
				self.parent.destroy()

		self.parent.bind("<Return>", buttonCallback)
		self.parent.bind("<KP_Enter>", buttonCallback)
		run = Button(self, text="Run fit", command=buttonCallback)
		run.grid(row=count, column=0)
		count = count + 1
		self.pack()
Example #50
0
    def initUI(self):
        #create initial Beings object (not instantiated until live is called)
        self.wc = WorldConfiguration()

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

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

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

        self.world = Canvas(self, background="#7474DB")
        self.world.grid(row=1,
                        column=0,
                        columnspan=3,
                        rowspan=8,
                        padx=5,
                        sticky=E + W + N + S)

        self.sbtn = Button(self, text="Stop")
        self.sbtn.grid(row=1, column=4, pady=5, sticky=E)

        self.bbox = Text(self, height=20, width=36)
        self.bbox.grid(row=3, column=4, padx=5, sticky=E + W + N + S)

        self.bbox1 = Text(self, height=11, width=36)
        self.bbox1.grid(row=4, column=4, padx=5, sticky=E + W + N + S)

        self.cbtn = Button(self, text="Close", command=self.parent.destroy)
        self.cbtn.grid(row=9, column=4, pady=5)

        self.cnfbtn = Button(self, text="Configure Universe")
        self.cnfbtn.grid(row=9, column=0, padx=5)

        self.timelbl = Text(self, height=1, width=10)
        self.timelbl.grid(row=2, column=4, pady=5)

        b = Beings(self)
        abtn = Button(
            self, text="Start", command=b.live
        )  #Beings(cnfbtn, world, 4, 10, sbtn, bbox, bbox1, timelbl).live)
        abtn.grid(row=1, column=4, pady=5, sticky=W)

        self.cnfbtn.config(command=b.configure)
Example #51
0
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"})    
Example #52
0
    def initUI(self):
        self.parent.title("Title")
        self.canvas = Canvas(self, bd=0)
        #canvas.pack()
        self.columnconfigure(0,weight=1)
        self.rowconfigure(0,weight=1)

        #self.canvas.create_image(0,0,image=self.photo,anchor=NW,tags="MAP")
        self.canvas.grid(row=0, sticky=W+N+E+S)
        self.bind("<Configure>", self.resize)

        button = Button(self)
        button.bind("<Button-1>", self.changeMapAc)
        button.grid(row=1)

        self.pack(fill=BOTH, expand=1)
Example #53
0
    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 __init__(self, master, sequencer):
        Frame.__init__(self, master)
        self.sequencer = sequencer

        self.control_label = Label(self, text="Control")

        self.start_button = Button(self, text="Start")
        self.stop_button = Button(self, text="Stop")

        self.start_button.config(command=self.sequencer.play)
        self.stop_button.config(command=self.sequencer.stop)

        self.control_label.pack()
        self.start_button.pack()
        self.stop_button.pack()

        Label(self, text='Tempo').pack()
        self.tempo_label = Label(self)
        self.tempo_label.pack()

        def set_tempo(v):
            tempo = float(v)
            self.sequencer.set_speed(tempo)
            self.tempo_label.config(text='%3.0f' % tempo)

        tempo_scale = Scale(self, from_=400, to=5, command=set_tempo, orient='vertical')
        tempo_scale.set(self.sequencer.speed)
        tempo_scale.pack()

        measure_control_frame = Frame(self)
        measure_control_frame.pack()

        self.measure_resolution = StringVar(measure_control_frame)
        self.measure_resolution.set(self.sequencer.measure_resolution)
        self.beats_per_measure = StringVar(measure_control_frame)
        self.beats_per_measure.set(self.sequencer.beats_per_measure)

        Label(measure_control_frame, text='Resolution').grid(row=0, column=0, sticky='E')
        measure_resolution_entry = Entry(measure_control_frame, textvariable=self.measure_resolution, width=3)
        measure_resolution_entry.grid(row=0, column=1)

        Label(measure_control_frame, text='Beats').grid(row=1, column=0, sticky='E')
        beats_per_measure_entry = Entry(measure_control_frame, textvariable=self.beats_per_measure, width=3)
        beats_per_measure_entry.grid(row=1, column=1)

        change_measure_update = Button(measure_control_frame, text='Update Measure', command=self.change_measures)
        change_measure_update.grid(row=2, columnspan=2)
Example #55
0
 def button_component(self,
                      button_txt,
                      init_txt,
                      r,
                      c,
                      help_txt='',
                      mode=NORMAL):
     '''adds a button component associated with an entry (the label only activates when help_txt != '')'''
     b = Button(self, text=button_txt)
     b.grid(row=r, column=c, sticky=W + E)
     b.config(state=mode)
     dir_var = StringVar()
     dir_var.set(init_txt)
     Entry(self, textvariable=dir_var).grid(row=r, column=c + 1)
     Label(self, text=help_txt).grid(row=r, column=c + 2, sticky=W)
     b.configure(command=lambda: self.browse_dir(dir_var, b))
     return dir_var
Example #56
0
class LevelsWindow(Tk):
    def __init__(self, menu):
        Tk.__init__(self)
        
        self.title("Pick a level")
        
        icon = PhotoImage(file=os.getcwd() + '/res/logo/logo.gif')
        self.tk.call("wm", "iconphoto", self._w, icon)
        
        self.eval('tk::PlaceWindow %s center' % self.winfo_pathname(self.winfo_id()))
        
        self.levels = [file[:-4] for file in listdir("res/levels")]
        self.protocol("WM_DELETE_WINDOW", self.shutdownTTK)
        
        if not self.levels:  # No levels
            self.withdraw()
            tkMessageBox.showwarning("Error", 'There doesn\'t seem to be any levels saved. Create one pressing the "Design Level" button!')
            self.shutdownTTK()
            
        else:
            self.menu = menu
            
            self.value = StringVar()
            self.levels_list = Combobox(self, textvariable=self.value, state='readonly')
            
            self.levels_list['values'] = self.levels
            self.levels_list.current(0)
            self.levels_list.grid(column=0, row=0)
            
            self.button = Button(self, text="Begin Level", command=self.begin_level)
            self.button.grid(column=0, row=1)
            self.mainloop()
    
            
            
    def begin_level(self):
        level = self.levels_list.get()
        self.shutdownTTK()
        self.menu.call_to("GameWindow", level)
    
    
    def shutdownTTK(self):
        # For some unholy reason, TTK won't shut down when we destroy the window
        # so we have to explicitly kill it.
        self.eval('::ttk::CancelRepeat')
        self.destroy()
Example #57
0
    def onClickNewConv(self, event):
        self.top = Toplevel()
        self.listContacts = Listbox(self.top)
        self.listNumbers = Listbox(self.top)
        for contact in pb:
            self.listContacts.insert(END,contact['FN'][0])

        self.listContacts.grid(row=0,column=0,sticky=W+S+N+E)
        self.listNumbers.grid(row=0,column=1,sticky=W+S+N+E)
        self.listContacts.bind('<<ListboxSelect>>',self.onClickContact)

        button = Button(self.top, text="Select",command=self.onClickNumber)
        button.grid(row=1,column=0)
        button = Button(self.top, text="Dismiss",command=self.top.destroy)
        button.grid(row=1,column=1)

        self.top.columnconfigure(0, weight=1)
        self.top.columnconfigure(1, weight=1)
        self.top.rowconfigure(0, weight=1)
Example #58
0
    def initUI(self):
      
        self.parent.title("Whiteboarder")
        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(4, weight=0)
        self.rowconfigure(5, pad=7)
        
        frame = Frame(self, relief=RAISED, borderwidth=1)
        #frame.pack()

        lbl = Label(self)
        lbl.grid(sticky=W, pady=5, padx=15)
        
        root = Tk()
        area = StructureCanvas(root)#Text(self)
        root.mainloop()
        area.grid(row=1, column=0, columnspan=2, rowspan= 6, 
            padx=15, sticky=E+W+S+N)
        #area.pack(side="top", fill="both", expand=True)
        
        def createLL():
            _LL_.linked_list()
            print "Linked List chosen"

        lbtn = Button(self, text="Linked List", command = createLL())
        lbtn.grid(row=1, column=3, padx = 2, pady=4)

        abtn = Button(self, text="Array")
        abtn.grid(row=2, column=3, padx = 2, pady=4)

        tbtn = Button(self, text="Tree")
        tbtn.grid(row=3, column=3, padx = 2, pady=4)

        ogbtn = Button(self, text="Other Graph")
        ogbtn.grid(row=4, column=3, padx = 2, pady=4)
        
        obtn = Button(self, text="Process")
        obtn.grid(row=7, column=3, pady=4)