示例#1
0
    def build_word(self):

        row = Frame(self.exportWord, width=30)
        row.pack(side=RIGHT)

        row_font = Frame(row, width=30)
        row_font.pack()

        lst1 = OPTIONS
        self.var1 = StringVar()
        self.var1.set(OPTIONS[1])
        self.font_name_box = OptionMenu(row_font, self.var1, *lst1)
        self.font_name_box.config(width=28)
        self.font_name_box.pack()


        row_size = Frame(row, width=30)
        row_size.pack()

        lst2 = OPTIONS_SIZE
        self.var2 = StringVar()
        self.var2.set(OPTIONS_SIZE[-1])
        self.font_size_box = OptionMenu(row_font, self.var2, *lst2)
        self.font_size_box.config(width=28)
        self.font_size_box.pack()

        row_button = Frame(row, width=30)
        row_button.pack()
        button_export = Button(row_button, width=30, height=2, text="EXPORT", command=self.choose_file_name)
        button_export.pack()
def OnButtonClick():
    

    e2.focus_set()
    e2.selection_range(0, END)

    e3.focus_set()
    e3.selection_range(0, END)

    e4.focus_set()
    e4.selection_range(0, END)
    
    win = Toplevel()
    win.title("Program Answer")
    if len(oracle_old_connection(e2.get(), e3.get())) > 0:
        cur = oracle_connection()
        alter_string = 'alter user %s identified by %s' % (e2.get(), e4.get())
        cur.execute(alter_string)
        message = "Password Successfully Updated"
        
        msg = Message(win, text=message)
        msg.pack()
        button = Button(win, text='OK', command=win.destroy)
        button.pack()
    else:
        message = "Error!!!!"
        
        msg = Message(win, text=message)
        msg.pack()
        button = Button(win, text='OK', command=win.destroy)
        button.pack()
示例#3
0
class Application(object):

    def __init__(self, root):
        self.counter = IntVar()
        self.counter.set(0)

        self.label = Label(root,
                           width=5,
                           font=("Helvetica", 20, "bold italic"),
                           textvariable=self.counter)
        self.label.pack(side="left")

        self.up = Button(root,
                         text="up",
                         background="RED",
                         command=self.increment)
        self.up.pack(side="left")

        self.down = Button(root,
                           text="down",
                           background="GREEN",
                           command=self.decrement)
        self.down.pack(side="left")

    def increment(self):
        self.counter.set(self.counter.get() + 1)

    def decrement(self):
        self.counter.set(max(0, self.counter.get() - 1))
示例#4
0
 def CreateWidgets(self):
     self.menu = StringVar(self)
     self.path = StringVar(self)
     self.fontSize = StringVar(self)
     self.frameMain = Frame(self, borderwidth=2, relief=GROOVE)
     self.frameMain.pack(side=TOP, expand=TRUE, fill=BOTH)
     labelMenu = Label(self.frameMain, anchor=W, justify=LEFT,
                       text='Menu Item:')
     self.entryMenu = Entry(self.frameMain, textvariable=self.menu,
                            width=30)
     self.entryMenu.focus_set()
     labelPath = Label(self.frameMain, anchor=W, justify=LEFT,
                       text='Help File Path: Enter URL or browse for file')
     self.entryPath = Entry(self.frameMain, textvariable=self.path,
                            width=40)
     self.entryMenu.focus_set()
     labelMenu.pack(anchor=W, padx=5, pady=3)
     self.entryMenu.pack(anchor=W, padx=5, pady=3)
     labelPath.pack(anchor=W, padx=5, pady=3)
     self.entryPath.pack(anchor=W, padx=5, pady=3)
     browseButton = Button(self.frameMain, text='Browse', width=8,
                           command=self.browseFile)
     browseButton.pack(pady=3)
     frameButtons = Frame(self)
     frameButtons.pack(side=BOTTOM, fill=X)
     self.buttonOk = Button(frameButtons, text='OK',
                            width=8, default=ACTIVE,  command=self.Ok)
     self.buttonOk.grid(row=0, column=0, padx=5,pady=5)
     self.buttonCancel = Button(frameButtons, text='Cancel',
                                width=8, command=self.Cancel)
     self.buttonCancel.grid(row=0, column=1, padx=5, pady=5)
示例#5
0
 class RecapEtOptionsCalculs(Frame):
     '''
     Interface graphique recapitulant les caracteristique du sismogramme
     presentant les options de filtrage et de calculs du noyau de sensibilite
     '''
     def __init__(self, master=None):
         Frame.__init__(self, master)
         self.pack(fill=BOTH)
         self.message = Label(self, text="Recapitulatif du sismogramme")
         self.message.pack()
         
         X=read(textPath.get())
         
         fRecap = Frame(self)
         self.recap = Text(fRecap, height =12, width = 70)
         self.recap.insert(INSERT, "network: {}\n".format(X[0].stats.network))
         self.recap.insert(INSERT, "station: {}\n".format(X[0].stats.station))
         self.recap.insert(INSERT, "location: {}\n".format(X[0].stats.location))
         self.recap.insert(INSERT, "channel: {}\n".format(X[0].stats.channel))
         self.recap.insert(INSERT, "starttime: {}\n".format(X[0].stats.starttime))
         self.recap.insert(INSERT, "endtime: {}\n".format(X[0].stats.endtime))
         self.recap.insert(INSERT, "sampling rate: {}\n".format(X[0].stats.sampling_rate))
         self.recap.insert(INSERT, "delta: {}\n".format(X[0].stats.delta))
         self.recap.insert(INSERT, "number points: {}\n".format(X[0].stats.npts))
         self.recap.insert(INSERT, "calibration: {}\n".format(X[0].stats.calib))
         self.recap.insert(INSERT, "format: {}\n".format(X[0].stats._format))
         self.recap.pack()
         fRecap.pack()            
         self.bouton_quitter = Button(self, text="continue", command=self.quit)
         self.bouton_quitter.pack(side="bottom")   
示例#6
0
 def create(self):
     start = Button(
         self, text="Start", command=self.start_oven, **BUTTON_STYLE)
     start.pack(side=LEFT)
     stop = Button(
         self, text="Stop / Clear", command=self.stop_oven, **BUTTON_STYLE)
     stop.pack(side=LEFT)
示例#7
0
def _replace_dialog(parent):
    root = Tk()
    root.title("Test ReplaceDialog")
    width, height, x, y = list(map(int, re.split('[x+]', parent.geometry())))
    root.geometry("+%d+%d"%(x, y + 150))

    # mock undo delegator methods
    def undo_block_start():
        pass

    def undo_block_stop():
        pass

    text = Text(root)
    text.undo_block_start = undo_block_start
    text.undo_block_stop = undo_block_stop
    text.pack()
    text.insert("insert","This is a sample string.\n"*10)

    def show_replace():
        text.tag_add(SEL, "1.0", END)
        replace(text)
        text.tag_remove(SEL, "1.0", END)

    button = Button(root, text="Replace", command=show_replace)
    button.pack()
示例#8
0
class App(Frame):

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

    def say_hi(self):
        print "hi there, everyone!"

    def initUI(self):
        self.QUIT = Button(self, text="Quit", fg="red", command=self.quit)
        self.QUIT.place(x=50, y=5)

        self.hi_there = Button(self)
        self.hi_there["text"] = "Hello",
        self.hi_there["command"] = self.say_hi
        self.hi_there.pack({"side": "left"})

        kpdf = Image.open("../qt/kpdf.png")
        self.kpdftk = ImageTk.PhotoImage(kpdf)
        self.label1 = Label(self, image=self.kpdftk)
        self.label1.place(x=200, y=10)

        self.parent.title("Sample V.01")
        self.pack(fill=BOTH, expand=1)
示例#9
0
class searchDialog(Toplevel):
        def __init__(self, parent, title):
                self.top = Toplevel(parent)
                self.top.wm_title(title)
                self.top.wm_minsize(width=300, height=400)
                self.top.bind("<Return>", self.searchThreader)
                self.top.bind("<Escape>", self.close)

                self.searchy = Text(self.top)
                self.searchy.config(wrap=WORD)
                self.search_entry = Entry(self.top)
                self.close = Button(self.top, text="Close", command=self.close)
                self.search_button = Button(self.top,
                                            text="Search",
                                            command=self.searchThreader)
                self.scrollbar = Scrollbar(self.top)

                self.scrollbar.pack(side=RIGHT, fill=Y, expand=0)
                self.searchy.config(yscrollcommand=self.scrollbar.set,
                                    state=DISABLED)
                self.searchy.pack(side=TOP, fill=BOTH, expand=1)
                self.search_entry.pack(side=LEFT, fill=X, expand=1)
                self.close.pack(side=RIGHT, fill=BOTH, expand=0)
                self.search_button.pack(side=RIGHT, fill=BOTH, expand=0)

                self.linker = HyperlinkManager(self.searchy)

        def close(self, event=None):
                global SEARCH
                SEARCH = None
                self.top.destroy()

        def putText(self, text):
                updateDisplay(text, self.searchy, self.linker)

        def clearSearch(self):
                self.searchy.config(state=NORMAL)
                self.searchy.delete(1.0, END)
                self.searchy.config(state=DISABLED)

        def searchThreader(self, event=None, text=None):
                self.sear = upThread(6, 'search', (self, text))
                self.sear.start()

        def search(self, toSearch=None):
                if toSearch is None:
                        keyword = self.search_entry.get()
                        self.search_entry.delete(0, END)
                else:
                        keyword = toSearch
                self.clearSearch()
                self.top.wm_title("Search - " + keyword)
                if keyword.split('@')[0] == '':
                        self.putText(
                            API.GetUserTimeline(
                                screen_name=keyword.split('@')[1]
                            )
                        )
                else:
                        self.putText(API.GetSearch(term=keyword))
示例#10
0
class Application(Frame):
    def __init__(self, master=None):
        Frame.__init__(self, master)
        self.pack()
        self.createWidgets()

    def createWidgets(self):
        self.titleLabel = Label(self, text='please input number and digit !')
        self.titleLabel.pack()
        self.numberLabel = Label(self, text='number: ')
        self.numberLabel.pack()
        self.numberInput = Entry(self)
        self.numberInput.pack()
        self.digitLabel = Label(self, text='digit: ')
        self.digitLabel.pack()
        self.digitInput = Entry(self)
        self.digitInput.pack()
        self.runButton = Button(self, text='run', command=self.run)
        self.runButton.pack()
        self.quitButton = Button(self, text='quit', command=self.quit)
        self.quitButton.pack()

    # run Button
    def run(self):
        number = self.numberInput.get()
        digit = self.digitInput.get()

        with open('E:/pycharm/practice1/image/verify.txt', 'w') as f:
            verify = verify_str(number, digit)
            f.write(verify)

        tkMessageBox.showinfo('verify', verify)
示例#11
0
    def createToolbar( self ):
        "Create and return our toolbar frame."

        toolbar = Frame( self )

        # Tools
        for tool in self.tools:
            cmd = ( lambda t=tool: self.activate( t ) )
            b = Button( toolbar, text=tool, font=self.smallFont, command=cmd)
            if tool in self.images:
                b.config( height=35, image=self.images[ tool ] )
                # b.config( compound='top' )
            b.pack( fill='x' )
            self.buttons[ tool ] = b
        self.activate( self.tools[ 0 ] )

        # Spacer
        Label( toolbar, text='' ).pack()

        # Commands
        for cmd, color in [ ( 'Stop', 'darkRed' ), ( 'Run', 'darkGreen' ) ]:
            doCmd = getattr( self, 'do' + cmd )
            b = Button( toolbar, text=cmd, font=self.smallFont,
                        fg=color, command=doCmd )
            b.pack( fill='x', side='bottom' )

        return toolbar
示例#12
0
	def initUI(self):
		
		self.pack(fill=BOTH, expand=1)
		
		#create special frame for buttons at the top
		frame = Frame(self)
		frame.pack(fill=X)
		
		search = Entry(frame)
		
		def callback():
			#create new window
			main(Search.SearchFrontPage(search.get()))
		
		b = Button(frame, text="Search", width=5, command=callback)
		b.pack(side=RIGHT)
		search.pack(side=RIGHT)
		
		def login():
			#change login credentials
			self.credentials = reddituserpass.main()
			self.parent.destroy()
		
		login = Button(frame, text="Login", width=5, command=login)
		login.pack(side=LEFT)
		
		self.drawWindow()
 def buttonbox(self):
     box = Frame(self)
     w = Button(box, text="Close", width=10, command=self.ok, default=ACTIVE)
     w.pack(side=LEFT, padx=5, pady=5)
     self.bind("<Return>", self.ok)
     self.bind("<Escape>", self.cancel)
     box.pack(side=BOTTOM)
示例#14
0
 def __init__(self, parent):
     Frame.__init__(self, parent)
     self.parent = parent
     
     open_button = Button(self, text = 'Calculate', relief = 'raised',
                          command=self._on_calculate, width = 23)
     open_button.pack()
示例#15
0
 def __init__(self, parent, title, action=None):
     self.action = action
     self.top = Toplevel(parent)
     Label(self.top, text=title).pack()
     if action:
         b = Button(self.top, text="Cancel", command=self.cancel)
         b.pack(pady=5)
示例#16
0
    def init_ui(self):
        self.parent.title("Sudoku")
        self.pack(fill=BOTH)
        self.canvas = Canvas(self,
                             width=WIDTH,
                             height=HEIGHT)
        self.canvas.pack(fill=BOTH, side=TOP)
        # clear_button = Button(self,
        # text="Clear answers",
        # command=self.__clear_answers)
        # clear_button.pack(fill=BOTH, side=BOTTOM)

        submit_button = Button(self,
                               text="Submit",
                               command=self.submit_answers)
        submit_button.pack(fill=X, side=BOTTOM)

        
        nonomino_button = Button(self,
                                 text="Nonomino",
                                 command=self.nonomino)
        nonomino_button.pack(fill=X, side=BOTTOM)

        self.draw_grid()
        self.draw_puzzle(False)

        self.canvas.bind("<Button-1>", self.cell_clicked)
        self.canvas.bind("<Key>", self.key_pressed)
示例#17
0
class LispTKButtonClass(BuildInFunction):
    def __init__(self,root,text,command,env):
        self.value=Button(root.value,text=text.value,command=command.execute_ea)
    
    def execute(self,env, *unEvalArgs):
        arg = LISP.Eval.evall(unEvalArgs[0], env)
        if(arg == new(LispSymbol,"pack")):
            self.value.pack(side="left")
        if(arg == new(LispSymbol,"setCMD")):
            arg1 = LISP.Eval.evall(unEvalArgs[1], env)
            self.value.configure(command=arg1.execute_ea)
        if(arg ==new(LispSymbol,'setBG')):
            val = LISP.Eval.evall(unEvalArgs[1], env)
            self.value.configure(bg=val.value)
        if(arg ==new(LispSymbol,'setFG')):
            val = LISP.Eval.evall(unEvalArgs[1], env)
            self.value.configure(fg=val.value)
    def execute_ea(self,*args):
        if(args[0] == new(LispSymbol,"pack")):
            self.value.pack(side="left")
        if(args[0] == new(LispSymbol,"setCMD")):
            self.value.configure(command=args[1].execute_ea)
        if(args[0]==new(LispSymbol,'setBG')):
            self.value.configure(bg=args[1])
        if(args[0]==new(LispSymbol,'setFG')):
            self.value.configure(fg=args[1])
示例#18
0
class MyFirstGUI:
    LABEL_TEXT = [
        "This is our first GUI!",
        "Actually, this is our second GUI.",
        "We made it more interesting...",
        "...by making this label interactive.",
        "Go on, click on it again.",
    ]

    def __init__(self, master):
        self.master = master
        master.title("A simple GUI")

        self.label_index = 0
        self.label_text = StringVar()
        self.label_text.set(self.LABEL_TEXT[self.label_index])
        self.label = Label(master, textvariable=self.label_text)
        self.label.bind("<Button-1>", self.cycle_label_text)
        self.label.pack()

        self.greet_button = Button(master, text="Greet", command=self.greet)
        self.greet_button.pack()

        self.close_button = Button(master, text="Close", command=master.quit)
        self.close_button.pack()

    def greet(self):
        print("Greetings!")

    def cycle_label_text(self, event):
        self.label_index += 1
        self.label_index %= len(self.LABEL_TEXT)  # wrap around
        self.label_text.set(self.LABEL_TEXT[self.label_index])
    def CreateWidgets(self):
        self.menu = StringVar(self)
        self.path = StringVar(self)
        self.fontSize = StringVar(self)
        self.frameMain = Frame(self, borderwidth=2, relief=GROOVE)
        labelMenu = Label(self.frameMain, anchor=W, justify=LEFT,
            text='Menu Item:')
        self.entryMenu = Entry(self.frameMain, textvariable=self.menu)
        labelPath = Label(self.frameMain, anchor=W, justify=LEFT,
            text='Help File Path: Enter URL or browse for file')
        self.entryPath = Entry(self.frameMain, textvariable=self.path,
            width=30)
        browseButton = Button(self.frameMain, text='Browse', width=8,
            command=self.browseFile)
        frameButtons = Frame(self)
        self.buttonOk = Button(frameButtons, text='OK', width=8,
            default=ACTIVE,  command=self.Ok)
        self.buttonCancel = Button(frameButtons, text='Cancel', width=8,
            command=self.Cancel)

        self.entryMenu.focus_set()

        self.frameMain.pack(side=TOP, expand=True, fill=BOTH)
        labelMenu.pack(anchor=W, padx=5, pady=3)
        self.entryMenu.pack(anchor=W, padx=5, pady=3, fill=X)
        labelPath.pack(anchor=W, padx=5, pady=3)
        self.entryPath.pack(anchor=W, padx=5, pady=3, side=LEFT, fill=X)
        browseButton.pack(pady=3, padx=5, side=RIGHT)
        frameButtons.pack(side=BOTTOM, fill=X)
        self.buttonOk.pack(pady=5, side=RIGHT)
        self.buttonCancel.pack(padx=5, pady=5, side=RIGHT)

        if TTK:
            frameButtons['style'] = 'RootColor.TFrame'
示例#20
0
def demo():

    from Tkinter import Tk, Frame, Button, BOTH, LEFT

    root = Tk()
    root.title("wckCalendar")

    def echo():
        print (view.getselection())

    view = Calendar(root, font="verdana", background="white", command=echo)
    view.pack(fill=BOTH, expand=1)

    buttonbox = Frame(root)
    def previous():
        date = view.getdate()
        if date.month == 1:
            view.setdate(date.year-1, 12)
        else:
            view.setdate(date.year, date.month-1)
    def next():
        date = view.getdate()
        if date.month == 12:
            view.setdate(date.year+1, 1)
        else:
            view.setdate(date.year, date.month+1)
    b = Button(buttonbox, text="previous", command=previous, width=10)
    b.pack(side=LEFT)
    b = Button(buttonbox, text="next", command=next, width=10)
    b.pack(side=LEFT)
    buttonbox.pack(expand=1, padx=2, pady=2)

    root.mainloop()
示例#21
0
    def __init__(self, master=None):
        Frame.__init__(self, master)

        self.parent = master

        self.parent.geometry("640x480")
        self.parent.title(os.getenv("NAME") + " - Stdout")

        self.textedit = Text(self.parent, font="mono 10")
        self.textedit.pack(expand=True, fill=BOTH)
        buton = Button(self.parent, text="Close", command=self.quit)
        buton.pack(side=RIGHT, expand=False, padx=10, pady=10, ipadx=10)

        ysb = Scrollbar(self.textedit, orient='vertical', command=self.textedit.yview)
        xsb = Scrollbar(self.textedit, orient='horizontal', command=self.textedit.xview)

        self.textedit.configure(yscroll=ysb.set, xscroll=xsb.set)

        xsb.pack(side=BOTTOM, fill=X, expand=False)
        ysb.pack(side=RIGHT, fill=Y, expand=False)

        self.textedit.pack(side=TOP, fill=BOTH, expand=True)


        self.show_file()
示例#22
0
文件: GUI.py 项目: JMDP5/FingersGame
class ChatWellcameForm(Template):
    '''
    Class for graphic presentation of chat client.
    Wellcome form with two buttons.
    '''
  
    def __init__(self, parent):
        Template.__init__(self, parent) 
        self.parent = parent        
        self.initUI()
        
    def initUI(self):
        '''
        Initialize all gui components
        '''
        
        self.welcometext = Label(self, text="Hello, world!")
        self.welcometext.pack(pady=20)
        self.localButton = Button(self,text="Game against computer", width=30)
        self.localButton.pack(pady=5)
        self.netButton = Button(self, text="Network game", width=30, command=self.openNetworkForm)
        self.netButton.pack(pady=5)
       
    
    def openNetworkForm(self):
        '''
        Opens form for network game end connects to server
        '''

        self.parent.destroy() 
        root = Tk()
        ex = ChatNetworkForm(root)
        root.geometry("300x250+300+300")
        root.mainloop() 
示例#23
0
    def initUI(self):
        self.parent.title("Layout Test")
        self.config(bg = '#F0F0F0')
        self.pack(fill = BOTH, expand = 1)

        #create canvas
        canvas1 = Canvas(self, 
                         relief = FLAT,
                         background = "#D2D2D2",
                         width = 180, 
                         height = 500)

        canvas1.pack(side = TOP,
                     anchor = NW, 
                     padx = 10, 
                     pady = 10)

        #add quit button
        button1 = Button(canvas1,
                         text = "Quit",
                         command = self.quit,
                         anchor = W)
        button1.configure(width = 10, 
                          activebackground = "#ee0000",
                          relief = FLAT)
        button1.pack(side = TOP)

        button2 = Button(canvas1,
                         text = "Start",
                         command = self.print_out,
                         anchor = W)
        button2.configure(width = 10, 
                          activebackground = "#00ee00",
                          relief = FLAT)
        button2.pack(side = TOP)
示例#24
0
	def __initUI__(self):
		# Title Name
	    self.parent.title("Sudoku")
	    # Fill frame's geometry relative to parent
	    self.pack(fill=BOTH, expand=1)
	    # General purpose widget to display board
	    self.canvas = Canvas(self,
	                         width=WIDTH,
	                         height=HEIGHT)
	    # Fill the entire space, place at the top
	    self.canvas.pack(fill=BOTH, side=TOP)
	    # Setup button to clear entire board
	    # Reinitialise to starting board setup
	    clear_button = Button(self,
	                          text="Clear answers",
	                          command=self.__clear_answers)
	    # Fill the entire space, place at the bottom
	    clear_button.pack(fill=BOTH, side=BOTTOM)
	    # Draw the grid
	    self.__draw_grid()
	    # Draw the numbers
	    self.__draw_board()
	    # Callbacks for mouse presses
	    self.canvas.bind("<Button-1>", self.__cell_clicked)
	    self.canvas.bind("<Key>", self.__key_pressed)
示例#25
0
class StarterWindow(Tk):
    def __init__(self):
        Tk.__init__(self)
        self.wm_title("FRCA QBase Reader - Start Menu")
        self.exambtn = Button(self, text="start an exam", command=self.startExam)
        self.exambtn.pack()
        self.maxquestvar = IntVar()
        self.maxquest = Spinbox(self, from_=1, to=1667, width=4, textvariable=self.maxquestvar)
        self.maxquest.pack()
        self.questbtn = Button(self, text="start single questions", command=self.startQuestions)
        self.questbtn.pack()
        self.um = """User manual:\n
		Start either an exam or single questions\n
		Go to next question either with mouse or the <right arrow>\n
		Toggle checkboxes either with mouse or <keyboard buttons 1-5>\n
		In single question mode, show answer either with mouse or <return>\n
		In exam mode, results will display after the set question number\n
		Text can be made bigger/smaller with <Up> or <Down> keyboard arrows"""
        self.usermanual = Label(self, text=self.um, justify=LEFT)
        self.usermanual.pack()

    def startExam(self):
        call(["python", "exam.py", str(self.maxquestvar.get())])

    def startQuestions(self):
        call(["python", "quest_by_quest.py"])
class App:
	def __init__(self,parent):
		# Create frame, buttons, etc
		self.f = Frame(parent)
		self.f.pack(padx=15,pady=15)
    
   		self.entry = Entry(self.f,text="Enter the search term")
		self.entry.pack(side= TOP,padx=10,pady=12)
		self.entry.bind("<Key>", self.key)
		self.entry.focus_set()
		
		self.exit = Button(self.f, text="Exit", command=self.f.quit)
		self.exit.pack(side=BOTTOM,padx=10,pady=10)

		self.button = Button(self.f, text="Search",command=self.search)
		self.button.pack(side=BOTTOM,padx=10,pady=10)

	def key(self, event):
		# If ENTER was pressed, search
		if event.char == '\r':
			self.search()

	def search(self):
		# If there's something to search, search!
		if self.entry.get() != '':
			self.button.config(text='Searching...', state=DISABLED)

			th = SearchThread(self, self.entry.get())
			th.start()
		else:
			tkMessageBox.showinfo('Hey', 'You should type something in the search. That\'s the point, really...')
示例#27
0
class MyFirstGUI:
    def __init__(self, master):
        self.master = master
        master.title("Address+")

        self.label = Label(master, text="Welcome to Address Plus!")
        self.label.pack()

        self.new_contact_button = Button(master, text="Add Contact", command=self.new_contact)
        self.new_contact_button.pack()

        self.close_button = Button(master, text="Close", command=master.quit)
        self.close_button.pack()

    def new_contact(self):
        self.first_name_label = Label(master=None, text="First Name:")
        self.first_name_label.pack()

        self.first_name_entry = Entry(master=None)
        self.first_name_entry.pack()

        self.last_name_label = Label(master=None, text="Last Name:")
        self.last_name_label.pack()

        self.last_name_entry = Entry(master=None)
        self.last_name_entry.pack()

        self.contact_number_label = Label(master=None, text="Phone Number:")
        self.contact_number_label.pack()

        self.contact_number_entry = Entry(master=None)
        self.contact_number_entry.pack()
示例#28
0
文件: list.py 项目: kd0kfo/todo
    def get_box(self):
        if not self.dialog:
            from Tkinter import Tk,Listbox,Button,Scrollbar,X,Y,BOTTOM,RIGHT,HORIZONTAL,VERTICAL,OptionMenu,StringVar
            self.dialog = Tk()
            self.dialog.title("TODO")
            scrollbar = Scrollbar(self.dialog,orient=HORIZONTAL)
            yscrollbar = Scrollbar(self.dialog,orient=VERTICAL)
            self.todolist = Listbox(self.dialog,width=50,xscrollcommand=scrollbar.set,yscrollcommand=yscrollbar.set)
            scrollbar.config(command=self.todolist.xview)
            scrollbar.pack(side=BOTTOM,fill=X)
            yscrollbar.config(command=self.todolist.yview)
            yscrollbar.pack(side=RIGHT,fill=Y)
            self.todolist.pack(side="left",fill="both",expand=True)
            
            cat_list_name = StringVar()
            cat_list_name.set("Category")
            

            btn = Button(self.dialog,text="Refresh",command=self.refresh_list)
            btn.pack()
            
            self.refresh_list()
            if self.categories:
                self.cat_list = OptionMenu(self.dialog,cat_list_name,*(self.categories+["ALL","NONE"]),command=self.filter_list)
                self.cat_list.pack()
        
        return (self.dialog,self.todolist)
示例#29
0
    def test_config_font(self):
         
        button = Tkbutton(self.master,text='foobar')
        button.pack(side=LEFT, fill=BOTH,expand=1)        

         
        font = tkFont.Font(family="Monospace", size=20)
        button.configure(font=font)
示例#30
0
def showPopup(s):
    popupRoot = Tk()
    popupRoot.after(2000)
    popupButton = Button(popupRoot,
                         text=s,
                         font=("Verdana", 12),
                         bg="yellow",
                         command=exit)
    popupButton.pack()
    popupRoot.geometry('400x50+700+500')
    popupRoot.mainloop()
示例#31
0
class App(Frame):
    def __init__(self, parent):
        Frame.__init__(self, parent, background="white")

        self.monitor = SerialMonitor()

        self.parent = parent

        self.frame = Frame(parent, relief=RAISED, borderwidth=1)

        self.scrollbar = Scrollbar(parent)

        self.receive_box = Text(parent, width=10, height=10, takefocus=0)
        self.transmit_box = Text(parent, width=10, height=10, takefocus=0)

        self.send_button = Button(parent, text="Send", command=self.send_message)

        self.initUI()
        self.process_serial_input()
        #self.send_message()


    def initUI(self):
        self.parent.title("Serial Monitor")

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

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

        self.scrollbar.pack(side=RIGHT, fill=Y)

        self.receive_box.pack(side=LEFT)
        self.receive_box.config(yscrollcommand=self.scrollbar.set, state=DISABLED)

        self.transmit_box.pack()

        self.scrollbar.config(command=self.receive_box.yview)

        self.send_button.pack(side=RIGHT, padx=5, pady=5)

    def process_serial_input(self):
        while self.monitor.available():
            try:
                self.receive_box.config(state=NORMAL)
                self.receive_box.insert('end', self.monitor.queue.get())
                self.receive_box.config(state=DISABLED)

            except Queue.Empty:
                pass
        self.after(100, self.process_serial_input)

    def send_message(self):
        message = self.transmit_box.get(1.0, 'end')
        self.monitor.write(message)
示例#32
0
 def add(self, tab, text):
     tab.pack_forget()  # hide the tab on init
     self.tabs[tab.tab_name] = tab  # add it to the list of tabs
     b = Button(self,
                text=text,
                relief=BASE,
                font='arial 10',
                command=(lambda name=tab.tab_name: self.switch_tab(name)
                         ))  # set the command to switch tabs
     b.pack(side=LEFT)  # pack the button to the left most of self
     self.buttons[tab.tab_name] = b  # add it to the list of buttons
示例#33
0
 def create_and_add_file_field(self, parent, title, pad, is_save):
     title_label = Label(parent, text=title)
     title_label.pack(side=Tkinter.TOP, padx=pad)
     container_frame = Frame(parent)
     container_frame.pack(side=Tkinter.TOP, padx=pad, pady=(0, pad))
     filename_entry = Entry(container_frame)
     filename_entry.pack(side=Tkinter.LEFT)
     browse_button = \
         Button(container_frame, text="Browse...",
                command=lambda: self.select_file(filename_entry, is_save))
     browse_button.pack(side=Tkinter.RIGHT)
     return filename_entry
示例#34
0
def gray(rad1):
    global variable3, m2, bandlist, w, w1, w2, w3, button, button1
    if w:
        w.destroy()
        w1.destroy()
        w2.destroy()
        button.destroy()
    variable3.set('select band')
    w3 = OptionMenu(m2, variable3, *bandlist)
    w3.pack(pady=(50, 0), padx=80)
    button1 = Button(m2, text="OK", command=ok1)
    button1.pack()
示例#35
0
文件: sudoku.py 项目: madixiu/Sudoku
              def __initUI(self):
                  self.parent.title("SudoKu")
                  self.pack(fill=BOTH,expand=1)
                  self.canvas = Canvas(self,width=WIDTH,height=HEIGHT)
                  self.canvas.pack(fill=BOTH,side=TOP)
                  clear_button=Button(self,text="Clear answers",command=self.__clear_answers)
                  clear_button.pack(fill=BOTH, side= BOTTOM)

                  self.__draw_grid()
                  self.__draw_puzzle()
                  self.canvas.bind("<Button-1>",self.__cell_clicked)
                  self.canvas.bind("<Key>",self.__key_pressed)
	def __init__(self, parent):

		top = self.top = Toplevel(parent)

		Label(top, text="Enter filename (+.png):").pack()

		self.e = Entry(top)
		self.e.pack(padx=5)

		b = Button(top, text="OK", command=self.ok)
		b.pack(pady=5)
		self.value = ""
示例#37
0
 def display_question(self, title, question, answer):
     top = Frame(self.master)
     top.pack()
     label = Label(top, text=question)
     label.pack()
     answer_text = Text(top)
     answer_text.insert(INSERT, answer)
     button = Button(
         top,
         text="Got the answer?",
         command=lambda answer=answer_text: self.show_answer(answer))
     button.pack()
示例#38
0
    def __init__(self, mainwin):
        """Simple Tkinter GUI example that shows a label and an exit button.

        :param mainwin: The Tk instance (also called 'root' sometimes
        """
        lbl = Label(mainwin, text="Hello World!", bg='yellow')
        exit_button = Button(mainwin,
                             text='Exit',
                             command=self.exit_btn_callback)
        # pack the widgets
        lbl.pack(side=LEFT)
        exit_button.pack(side=RIGHT)
示例#39
0
def FavsWnd():
    favourites = Tk()
    favourites.title("Favvourite Recipes")
    label_1 = Label(favourites, text="Favourites")
    label_1.pack()
    favBox = Listbox(favourites, width="25", height="25")
    favBox.pack()
    butn = Button(favourites, text="open")
    butn.pack()
    butnn = Button(favourites, text="delete from favourites", command=del_fav)
    butnn.pack()
    favourites.mainloop()
示例#40
0
def cp_button(root,
              label,
              action,
              button_conf={},
              pack_conf={
                  'side': "top",
                  'fill': "both",
                  'expand': 'True'
              }):
    button = Button(master=root, text=label, command=action, **button_conf)
    button.pack(**pack_conf)
    return button
示例#41
0
def All_recipes():
    all_recipes = Tk()
    all_recipes.title("The Cookbook Club")
    labell_1 = Label(all_recipes, text="All Recipes")
    labell_1.pack()
    recBox = Listbox(all_recipes, width="25", height="25")
    recBox.pack()
    butn = Button(all_recipes, text="open")
    butn.pack()
    butn2 = Button(all_recipes, text="Add to Favourites List")
    butn2.pack()
    all_recipes.mainloop()
示例#42
0
class Error:
    def __init__(self, master):
        self.master = master
        self.master.title('ERROR')

        self.frame = Frame(master)
        self.frame.pack(ipadx=40, ipady=10)
        self.exit_button = Button(self.frame, text='Exit', command=the_end)
        self.exit_button.pack(side='bottom', ipadx=10, pady=10)
        self.message = Label(self.frame, text='Connection Failed ' +
                                              'Please Check Dongle Connection.')
        self.message.pack(side='bottom')
示例#43
0
def my_button(root, label_text, button_text, button_func):
    '''''function of creat label and button'''
    # label details
    label = Label(root)
    label['text'] = label_text
    label.pack()
    # label details
    button = Button(root)
    button['text'] = button_text
    button['command'] = button_func
    button.pack()
    return 0
示例#44
0
class MySecondGUI:
    def __init__(self, master):
        if len(sys.argv) < 2:
            self.name = "default"
        else:
            self.name = sys.argv[1]

        self.master = master
        master.title("reading window")

        self.label = Label(master, text="This is our second GUI!")
        self.label.pack()

        self.text = Text(width=25, height=5, bg="darkgreen", fg='white')
        self.text.pack()

        self.read_button = Button(master,
                                  width=9,
                                  text="Read text",
                                  command=self.read)
        self.read_button.pack()
        self.read_button.place(x=120, y=40)

        self.close_button = Button(master,
                                   width=9,
                                   text="Close",
                                   command=master.quit)
        self.close_button.pack()
        self.close_button.place(x=120, y=70)

        self.pin = 0

    def read(self):
        str_audio_name = self.name + "_combined.wav"
        open(str_audio_name, "w")
        os.remove(str_audio_name)
        open(str_audio_name, "w")
        text = self.text.get("1.0", 'end')
        user_text = map(lambda c: c, text)
        combined = AudioSegment.from_file(self.name + "_" + user_text[0] +
                                          ".wav")
        combined.export(str_audio_name, format='wav')
        user_text.pop(0)
        for number in user_text:
            if number == '\n' or number == ' ':
                continue
            sound1 = AudioSegment.from_file(str_audio_name)
            sound2 = AudioSegment.from_file(self.name + "_" + number + ".wav")
            combined = sound1 + sound2
            combined.export(str_audio_name, format='wav')
        self.pin = subprocess.call("python voice_acting.py " + str_audio_name,
                                   shell=True)
示例#45
0
    def buttonbox(self):
        '''add modified button box.
        override standard one to get rid of key bindings which cause trouble with text widget
        '''

        box = Frame(self)
        w = Button(box, text="OK", width=10, command=self.ok, default=ACTIVE)
        w.pack(side=LEFT, padx=5, pady=5)
        w = Button(box, text="Cancel", width=10, command=self.cancel)
        w.pack(side=LEFT, padx=5, pady=5)
        # self.bind("<Return>", self.ok)
        # self.bind("<Escape>", self.cancel)
        box.pack()
    def build_finalbuttons(self):

        _ypadhere_ = 1
        Frame(self).pack(side="top", fill='x', pady=35)  # Space

        _row_ = self
        self.b1 = Button(_row_,
                         text='Convert',
                         command=self.getdata_and_convert)
        self.b1.pack(side='right', padx=30, pady=_ypadhere_)

        b2 = Button(_row_, text='Quit', command=self.quit)
        b2.pack(side='right', padx=10, pady=_ypadhere_)
示例#47
0
class Application(Frame):
    def __init__(self, master=None):
        Frame.__init__(self, master)
        self.pack()
        self.createWidgets()

    def createWidgets(self):
        self.helloLabel = Label(self, text='Hello, world!')
        self.helloLabel.pack()
        self.quitButton = Button(self, text='Quit', command=self.quit)
        self.quitButton.pack()
        self.quitButton=Button(self,text='ok',command=self.quit)
        self.quitButton.pack()
示例#48
0
def show_info(*args):
    if list_box.curselection():
        cs_name = list_box.get(list_box.curselection())
        cs = cardsets_dict[cs_name]
        fn = os.path.join(cs.dir, 'COPYRIGHT')
        top = Toplevel()
        text = Text(top)
        text.insert('insert', open(fn).read())
        text.pack(expand=YES, fill=BOTH)
        b_frame = Frame(top)
        b_frame.pack(fill=X)
        button = Button(b_frame, text='Close', command=top.destroy)
        button.pack(side=RIGHT)
示例#49
0
    class Application(Frame):  # Class for implementation of exitGui
        def CreateWidgets(self):
            self.QUIT = Button(self)
            self.QUIT["text"] = "QUIT"
            self.QUIT["fg"] = "red"
            self.QUIT["command"] = self.quit

            self.QUIT.pack({"side": "left"})

        def __init__(self, master=None):
            Frame.__init__(self, master)
            self.pack()
            self.CreateWidgets()
示例#50
0
    def __init__(self, parent, method):
        Frame.__init__(self, parent)
        self.parent = parent
        self.method = method

        open_button = Button(self,
                             text='Classify',
                             relief='raised',
                             command=self._on_classify_image,
                             width=23)
        open_button.pack()

        self.observers = []
示例#51
0
class closing_comment():
    def __init__(self, master):
        self._master = master
        self.interior = Frame(master, class_="closing")

        instruction_label_frame = Frame(self.interior, class_="closing")
        instruction_label_frame.pack(fill=X)

        self.title_font = tkfont.Font(family='Helvetica',
                                      size=18,
                                      weight="bold",
                                      slant="italic")
        self.content_font = tkfont.Font(family='Helvetica', size=14)
        self._label_instruction = Label(
            instruction_label_frame,
            text="Please give your overall comment to the system.",
            font=self.title_font)
        self._label_instruction.pack()

        # entry form
        self.var_entry = StringVar()
        entry_frame = Frame(self.interior, class_="entry")
        entry_frame.pack(fill=X)

        self._entry_comment = Entry(entry_frame,
                                    width=70,
                                    textvariable=self.var_entry)
        self._entry_comment.pack(side=LEFT, fill='both', expand=True)

        #button
        button_frame = Frame(self.interior, class_="Submit")
        button_frame.pack(fill=X)

        self._button_next = Button(button_frame,
                                   text="Submit",
                                   command=self.close_window,
                                   width=50,
                                   font=self.content_font)
        self._button_next.pack()
        self._button_next.bind("<Button-1>", self._on_button_submit)
        self._button_next.focus()

    def close_window(self):
        self._master.destroy()

    def _on_button_submit(self, event):
        # get the input from user
        print("var_entry:", self.var_entry.get())

        _log = open("log.txt", "a")
        _log.write("\nClosing comment: %s" % self.var_entry.get())
示例#52
0
class GUIButtons:
    def __init__(self, master, rLED, lLED, lickPin, rewardPin):
        frame = Frame(master)
        frame.pack()
        bottomFrame = Frame(master)
        bottomFrame.pack()

        self.leftLED = Button(frame,
                              text="Left LED",
                              command=lambda: testButton(1))
        self.leftLED.pack(side="left", pady=5, padx=5)

        self.rightLED = Button(frame,
                               text="Right LED",
                               command=lambda: testButton(2))
        self.rightLED.pack(pady=5, padx=5)

        self.solenoid = Button(bottomFrame,
                               text="Solenoid",
                               command=lambda: testButton(3))
        self.solenoid.pack(pady=5, padx=5)

        self.lickSensor = Button(bottomFrame,
                                 text="Lick Sensor",
                                 command=lambda: testButton(4))
        self.lickSensor.pack(pady=5, padx=5)
示例#53
0
class clientGUI:
    def __init__(self, master, server_socket):
        self.master = master
        self.server = server_socket
        master.title("GUI")

        self.label = Label(master, text="Click to send command!")
        self.label.pack()

        self.greet_button = Button(master, text="Send Command", command=self.sendCommand)
        self.greet_button.pack()

    def sendCommand(self):
        self.server.send(b"cmd:move_to_position_debug/nargs:3/arg1:0.0/arg2:0.0/arg3:0.0")
示例#54
0
    def __initUI(self):
        self.parent.title("Sudoku")
        self.pack(fill=BOTH)
        self.canvas = Canvas(self, width=WIDTH, height=HEIGHT)
        self.canvas.pack(fill=BOTH, side=TOP)

        clear_puzzle_button = Button(self,
                                     text="Clear Puzzle",
                                     command=self.__clear_puzzle)
        clear_puzzle_button.pack(side=LEFT, padx=PAD)

        clear_solution_button = Button(self,
                                       text="Clear Solution",
                                       command=self.__clear_solution)
        clear_solution_button.pack(side=LEFT, padx=PAD)

        solve_button = Button(self, text="Solve", command=self.__solve_puzzle)
        solve_button.pack(side=LEFT, padx=PAD)

        count_button = Button(self,
                              text="Count Solutions",
                              command=self.__count_solutions)
        count_button.pack(side=LEFT, padx=PAD)

        self.__draw_grid()
        self.__draw_puzzle()

        self.canvas.bind("<Button-1>", self.__cell_clicked)
        self.canvas.bind("<Key>", self.__key_pressed)
示例#55
0
class MyFirstGUI:
    def __init__(self, master):
        self.master = master
        master.title("Servo Control")

        self.label = Label(master, text="This is our first GUI!")
        self.label.pack()

        self.serv_btn1 = Button(master, text="Servo 1", command=self.servo1)
        self.serv_btn1.grid(row=0, column=1)
        self.serv_btn1.pack()

        self.serv_btn2 = Button(master, text="Servo 2", command=self.servo2)
        self.serv_btn2.pack()

        self.serv_btn3 = Button(master, text="Servo 3", command=self.servo3)
        self.serv_btn3.pack()

        self.close_button = Button(master, text="Close", command=master.quit)
        self.close_button.pack()

    def greet(self):
        print("Greetings!")

    def servo1(self):
        print("Running Servo 1")

    def servo2(self):
        print("Running Servo 2")

    def servo3(self):
        print("Running Servo 3")
示例#56
0
def startapp():
    root1 = Tk()
    root1.geometry('300x300')
    root1.title('Rappel')
    label1 = Label(root1,
                   text='Hi..Welcome To Our Project RAPPEL..!!',
                   font='bold')
    label1.pack()
    button1 = Button(root1, text='Get Started', font='bold', command=homepage)
    button1.pack()
    pic = PhotoImage(file='hi.png')
    label2 = Label(root1, image=pic)
    label2.pack()
    root1.mainloop()
示例#57
0
def wybierajZestawZnakow(zestawieZnakow):
    gui = Tk()
    gui.resizable(0, 0)
    gui.title("")
    fra1 = LabelFrame(gui, text="Stary zestaw znaków")
    fra1.pack(padx=2, pady=2)
    var1 = StringVar()
    var1.set(zestawieZnakow[0])
    opt1 = OptionMenu(fra1, var1, *zestawieZnakow)
    opt1.pack(fill="x")
    but1 = Button(fra1, text="Otwieraj plik", command=lambda: gui.destroy())
    but1.pack(fill="x", padx=2, pady=2)
    gui.mainloop()
    return var1.get()
示例#58
0
 def __init__(self, master, title, message):
     Toplevel.__init__(self, master=master)
     self.title(title)
     Label(self, text=message, anchor=W, justify=LEFT).pack(pady=10,
                                                            padx=10)
     x = master.winfo_x() + master.winfo_width() // 2
     y = master.winfo_y() + master.winfo_height() // 2
     self.wm_geometry("+{:d}+{:d}".format(x, y))
     self.resizable(False, False)
     self.transient(master)
     self.grab_set()
     self.focus_force()
     b = Button(self, text="OK", command=self.ok)
     b.pack(pady=2, padx=5)
示例#59
0
class App(Frame):
    def robot_enable(self):
        print "Enable"
        self.ds.state_lock.acquire()
        self.ds.state.enable()
        self.ds.state_lock.release()

    def robot_disable(self):
        print "Disable"
        self.ds.state_lock.acquire()
        self.ds.state.disable()
        self.ds.state_lock.release()

    def robot_reset(self):
        print "Reset"
        self.ds.state_lock.acquire()
        self.ds.state.reset_robot()
        self.ds.state_lock.release()

    def exit(self):
        self.ds.stop()
        print "Quit"
        self.quit()
        sys.exit(0)

    def create_widgets(self):
        self.QUIT = Button(self)
        self.QUIT["text"] = "QUIT"
        self.QUIT["fg"] = "red"
        self.QUIT["command"] = self.exit

        self.QUIT.pack({"side":"left"})

        self.disable = Button(self)
        self.disable["text"] = "Disable"
        self.disable["command"] = self.robot_disable
        self.disable.pack({"side":"left"})

        self.enable = Button(self)
        self.enable["text"] = "Enable"
        self.enable["command"] = self.robot_enable
        self.enable.pack({"side":"left"})

        self.reset_button = Button(self)
        self.reset_button["text"] = "Reset"
        self.reset_button["command"] = self.robot_reset
        self.reset_button.pack({"side":"left"})

    def __init__(self, master=None):
        Frame.__init__(self, master)

        self.ds = DS(3081, joystick_thread=JoystickUpdateThread())
        self.ds.start()
        self.QUIT = None
        self.enable = None
        self.disable = None
        self.reset_button = None
        self.pack()
        self.create_widgets()
示例#60
-1
class Recherche(Vue):
    """
    Vue principal
    """
    def __init__(self, fenetre):
        """
        Constructeur de la fenetre
        """
        self.parent = fenetre
        self.frame = Frame(self.parent, borderwidth=1, relief='groove', width=100)
        self.frame.pack_configure(side='top', fill='both')
        self.frame.pack()
        self.titre = Label(self.frame, text=GT_('Url'), font=(20))
        self.titre.pack()
        self.img = PhotoImage(file="%slogo.gif" % RESSOURCES_PATH)
        self.logo = Label(self.frame, image=self.img)
        self.logo.pack(pady=(0, 20), side="left")
        self.brand = Label(self.frame, text=GT_('WebForge %s' % VERSION), font=(20))
        self.brand.pack(pady=(10, 20), padx=(0, 20), side="left")
        self.txt_recherche = Entry(self.frame, font=(22))
        self.txt_recherche.pack(pady=(0, 20), expand='yes', fill='both', side='left')
        self.btn_go = Button(self.frame, text="GO")
        self.btn_go.pack(pady=(0, 20), side='right')
        self.btn_erase = Button(self.frame, text="X")
        self.btn_erase.pack(pady=(0, 20), side='right')

    def set_url(self, url):
        """
        Set a new url value to the field
        """
        self.txt_recherche.insert(0, url)