示例#1
2
    def initUI(self):
        #setup title
        self.master.title("Component Creator")
        self.style = Style()
        self.style.theme_use("clam")

        #indicator label
        self.labelName = Label(self, text="Component Name:")
        self.labelName.place(x=10, y=10)
        self.master.update()

        # create variable and namefield for input of component name
        sv = StringVar()
        sv.trace("w", lambda name, index, mode, sv=sv: self.nameChanged(sv))
        self.nameField = Entry(self, textvariable=sv)
        self.nameField.place(x=10+self.labelName.winfo_width() + 10, y=10)
        self.master.update()

        # label for image name that will show img name for a given component name
        self.imgNameVar = StringVar()
        self.imgNameVar.set('imageName:')
        self.labelImageName = Label(self, textvariable=self.imgNameVar)
        self.labelImageName.place(x=10+self.labelName.winfo_width()+10,y=40)

        # checkbox for visible component or not
        self.cbVar = IntVar()
        self.cb = Checkbutton(self, text="Visible Component",  variable=self.cbVar)
        self.cb.place(x=10, y=70)

        # dropdown list for category
        self.labelCategory = Label(self, text="Category:")
        self.labelCategory.place(x=10, y=110)
        self.master.update()

        acts = ['UserInterface', 'Layout', 'Media', 'Animation', 'Sensors', 'Social', 'Storage',
                'Connectivity', 'LegoMindStorms', 'Experimental', 'Internal', 'Uninitialized']

        self.catBox = Combobox(self, values=acts)
        self.catBox.place(x=10+self.labelCategory.winfo_width()+10, y=110)

        # button to select icon image
        self.getImageButton = Button(self, text="Select icon", command=self.getImage)
        self.getImageButton.place(x=10, y=150)
        self.master.update()

        # explanation for resizing
        self.resizeVar = IntVar()
        self.resizeCB = Checkbutton(self,
            text="ON=Resize Image (Requires PIL)\nOFF=Provide 16x16 Image", variable=self.resizeVar)
        self.resizeCB.place(x=10+self.getImageButton.winfo_width()+10, y=150)

        # create button
        self.createButton = Button(self, text="Create", command=self.create)
        self.createButton.place(x=10, y=230)

        #cancel button
        self.cancelButton = Button(self, text="Cancel", command=self.quit)
        self.cancelButton.place(x=200, y=230)
示例#2
0
        def _make_rcv_log(self):
            # make receive log
            recvLogFrame = Frame(self, width=400, height=200)
            recvLogFrame.style = self.style
            recvLogFrame.grid(row=2,
                              column=0,
                              padx=2,
                              pady=2,
                              sticky=N + S + E + W)
            self.start_stop_button = Button(self,
                                            text="Stop",
                                            command=self.start_stop_clicked)
            self.start_stop_button.style = self.style
            self.start_stop_button.grid(row=2,
                                        column=1,
                                        padx=2,
                                        pady=2,
                                        sticky=N + S + E + W)

            # make a scrollbar
            self.scrollbar = Scrollbar(recvLogFrame)
            self.scrollbar.pack(side=RIGHT, fill=Y)

            # make a text box to put the serial output
            self.log = Text(recvLogFrame,
                            width=50,
                            height=30,
                            takefocus=0,
                            borderwidth=1,
                            relief='ridge')
            self.log.pack(fill=BOTH, expand=True)

            # attach text box to scrollbar
            self.log.config(yscrollcommand=self.scrollbar.set)
            self.scrollbar.config(command=self.log.yview)
	def initUI(self):

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

		#	Configures padding between items in application
		self.columnconfigure(1, weight=1)
		self.columnconfigure(3, pad=7)
		self.rowconfigure(3, weight=1)
		self.rowconfigure(5, pad=7)

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

		self.area = Label(self)
		#	Column and row span make box go to that column/row
		self.area.grid(row=1, column=0, columnspan=2, rowspan=4, padx=5, sticky=E+W+S+N)

		self.abtn = Button(self, text="Connect", command = self.connect)
		# self.abtn["command"] = update_box()
		self.abtn.grid(row=1, column=3)

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

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

		self.obtn = Button(self, text="Open")
		self.obtn.grid(row=5, column=3)
    def initUI(self):

        self.parent.title("FirstGUI")
        self.pack(fill=BOTH, expand=1)

        quitButton = Button(self, text="Quit", command=self.quit)
        quitButton.place(x=100, y=100)
示例#5
0
    def initUI(self):

        self.parent.title("HW3")

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

        Button(self, text="Select File", command=openFile).grid(row=0,
                                                                column=0,
                                                                pady=5)
        self.fileName = StringVar()
        Label(self, textvariable=self.fileName).grid(row=0,
                                                     column=1,
                                                     columnspan=2,
                                                     pady=5,
                                                     sticky=W)

        Label(self, text="Select Mode: ").grid(row=1, column=0, pady=5)
        mode = StringVar(self)
        mode.set("Q1-ColorHistogram")
        om = OptionMenu(self, mode, "Q1-ColorHistogram", "Q2-ColorLayout",
                        "Q3-SIFT Visual Words",
                        "Q4-Visual Words using stop words")
        om.grid(row=1, column=1, pady=5, sticky=W)

        Button(self,
               text="SEARCH",
               command=lambda: startSearching(self.fileName.get(), mode.get())
               ).grid(row=3, column=0, pady=5)

        self.images = []
        for i in range(10):
            self.images.append(Label(self))
            self.images[i].grid(row=i / 5 + 4, column=i % 5, pady=50)
示例#6
0
    def initUI(self):
      
        self.parent.title("Batch Geocoder")
        self.style = Style()
        self.style.theme_use("default")
        self.pack(fill=BOTH, expand=1)

        quitButton = Button(self, text="Quit", command=self.quit)
        quitButton.place(x=50, y=50)
        
        menubar = Menu(self.parent)
        self.parent.config(menu=menubar)
        
        scrollbar = Scrollbar(self)
        scrollbar.pack( side = RIGHT, fill=Y)
        
		
        fileMenu = Menu(menubar)
        fileMenu.add_command(label="Run", command=self.onOpen)
        fileMenu.add_command(label="Exit", underline=0, command=self.onExit)
        
        menubar.add_cascade(label="File", menu=fileMenu)
        #menubar.add_command(label="Run", command=self.runScript)
        
        self.txt = Text(self, yscrollcommand = scrollbar.set)
        scrollbar.config( command = self.txt.yview )
        self.txt.pack(fill=BOTH, expand=1)
示例#7
0
    def initUI(self):
        

        information = Label(self,text = " \n Information on "+business_list[int(business_index)]['name']+"\n \n Located at: \n " + business_list[int(business_index)]['full_address'] )
        information.pack() 
        num_reviews  = Label(self, text = "Number of Reviews : " + str(business_list[int(business_index)]['review_count']) )    
        num_reviews.pack()
        
        type = Label(self, text = "Type of Restaurant : " + str(business_list[int(business_index)]['type']) )    
        type.pack()
        
        cat = business_list[int(business_index)]['categories']
        text_cat = ''
        for item in cat:
            text_cat = text_cat + ", " + item
        
        categories = Label(self, text = "Category of the resaurtant "+ text_cat )
        categories.pack()
        
        w = Label(self, text=" \n Write a Review for "+business_list[int(business_index)]['name'] )        
        w.pack() 
  
        e = Text(self, height=20, width=100)
        e.insert(END,"Insert Review Here")    
        e.pack()
        b = Button(self, text="Submit Review",command=lambda: self.tostars(e.get(1.0, END)))
        b.pack(side=BOTTOM, fill=BOTH)
        self.pack(fill=BOTH, expand=1)
示例#8
0
    def __init__(self, name, add_handler, remove_handler, master=None):
        """
        Creates a ListFrame with the given name as its title.

        add_handler and remove_handler are functions to be called
        when items are added or removed, and should relay the information
        back to the Searcher (or whatever object actually uses the list).
        """
        LabelFrame.__init__(self, master)
        self['text'] = name
        self.add_handler = add_handler
        self.remove_handler = remove_handler
        self.list = Listbox(self)
        self.list.grid(row=0, columnspan=2)
        # Tkinter does not automatically close the right-click menu for us,
        # so we must close it when the user clicks away from the menu.
        self.list.bind("<Button-1>", lambda event: self.context_menu.unpost())
        self.list.bind("<Button-3>", self.open_menu)
        self.context_menu = Menu(self, tearoff=0)
        self.context_menu.add_command(label="Remove", command=self.remove)
        self.input = Entry(self)
        self.input.bind("<Return>", lambda event: self.add())
        self.input.grid(row=1, columnspan=2)
        self.add_button = Button(self)
        self.add_button['text'] = "Add"
        self.add_button['command'] = self.add
        self.add_button.grid(row=2, column=0, sticky=W+E)
        self.remove_button = Button(self)
        self.remove_button['text'] = "Remove"
        self.remove_button['command'] = self.remove
        self.remove_button.grid(row=2, column=1, sticky=W+E)
示例#9
0
    def initUI(self):

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

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

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

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

        fileMenu = Menu(menubar)
        fileMenu.add_command(label="Run", command=self.onOpen)
        fileMenu.add_command(label="Exit", underline=0, command=self.onExit)

        menubar.add_cascade(label="File", menu=fileMenu)
        #menubar.add_command(label="Run", command=self.runScript)

        self.txt = Text(self, yscrollcommand=scrollbar.set)
        scrollbar.config(command=self.txt.yview)
        self.txt.pack(fill=BOTH, expand=1)
示例#10
0
    def initUI(self):

        self.entries_found = []

        self.parent.title("Search your command cards")
        self.style = Style()
        self.style.theme_use("default")
        self.pack()

        self.input_title = Label(self, text="Enter your command below")
        self.input_title.grid(row=0, columnspan=2)
        self.input_box = Entry(self, width=90)
        self.input_box.grid(row=1, column=0)
        self.input_box.focus()
        self.input_box.bind("<Key>", self.onUpdateSearch)
        self.search_btn = Button(self, text="Search", command=self.onSearch)
        self.search_btn.grid(row=1, column=1)
        self.output_box = Treeview(self, columns=("Example"))
        ysb = Scrollbar(self, orient='vertical', command=self.output_box.yview)
        xsb = Scrollbar(self,
                        orient='horizontal',
                        command=self.output_box.xview)
        self.output_box.configure(yscroll=ysb.set, xscroll=xsb.set)
        self.output_box.heading('Example', text='Example', anchor='w')
        self.output_box.column("#0", minwidth=0, width=0, stretch=NO)
        self.output_box.column("Example", minwidth=0, width=785)
        self.output_box.bind("<Button-1>", self.OnEntryClick)
        self.output_box.grid(row=3, columnspan=2)
        self.selected_box = Text(self, width=110, height=19)
        self.selected_box.grid(row=4, columnspan=2)
        self.gotoadd_btn = Button(self,
                                  text="Go to Add",
                                  command=self.onGoToAdd)
        self.gotoadd_btn.grid(row=5)
示例#11
0
    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)
示例#12
0
 def __init__(self, master=Tk()):
     Frame.__init__(self, master)
     self.grid()
     self.llbutton = Button(self, text="Linked List", command=self.createLL)
     self.llbutton.grid()
     self.canvas = Canvas(master, bg="white", height=750, width=1000)
     self.canvas.pack()
示例#13
0
    def initUI(self):
        self.parent.title("Book downloader")
        self.style = Style()
        self.style.theme_use("default")
        
        framesearch = Frame(self)
        framesearch.pack(fill=BOTH)

        search_label = Label(framesearch, text="Filter books:", padx=5, pady=5, width=15)
        search_label.pack(side=LEFT)

        self.search_entry = Entry(framesearch)
        self.search_entry.pack(side=RIGHT, fill=X)
        self.search_entry.bind("<Return>", self.searchHandler)
        #self.search_entry.bind("<Key>", self.searchHandler)
        
        framelist = Frame(self, relief=RAISED, borderwidth=1)
        framelist.pack(fill=BOTH, expand=True)

        self.lb = Listbox(framelist, height=30)
        scrollbar = Scrollbar(framelist)
        scrollbar.pack(side=RIGHT, fill=Y)
        self.lb.config(yscrollcommand=scrollbar.set)
        scrollbar.config(command=self.lb.yview)
        
        self.loadLibrary()
        for b in self.book_list:
            self.lb.insert(END, b[0])
        self.lb.pack(fill=BOTH)
        
        self.pack(fill=BOTH, expand=True)
        
        DownButton = Button(self, text="Download", command=self.downloadAction)
        DownButton.pack(side=RIGHT)
示例#14
0
 def initUI(self):
   
     self.parent.title("FirstGUI")
     self.pack(fill=BOTH, expand=1)
     
     quitButton = Button(self, text="Quit", command=self.quit)
     quitButton.place(x=100, y=100)
示例#15
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)
示例#16
0
    def initUI(self):
        try:
            self.parent.title("Mighty Cracker")
            self.style = Style()
            self.style.theme_use("default")

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

            #load buttons and labels
            self.closeButton= Button(self, text="Close Program", command=self.confirmExit)
            self.closeButton.pack(side=BOTTOM, padx=5, pady=5)
            self.mainMenuLabel= Label(self, text="Main Menu")
            self.mainMenuLabel.pack(side=TOP,padx=5, pady=5)
            self.singleModeButton= Button(self, text="Single Computer Mode", command=self.unpackInitUI_LoadSingleComputerMode)
            self.singleModeButton.pack(side=TOP, padx=5, pady=5)
            self.networkModeButton= Button(self, text="Networking Mode", command=self.unpackInitUI_LoadNetworkMode)
            self.networkModeButton.pack(side=TOP, padx=5, pady=5)

        except Exception as inst:
            print "============================================================================================="
            print "GUI ERROR: An exception was thrown in initUI definition Try block"
            #the exception instance
            print type(inst)
            #srguments stored in .args
            print inst.args
            #_str_ allows args tto be printed directly
            print inst
            print "============================================================================================="
示例#17
0
    def networkServerUI(self):
        try:
            self.parent.title("Mighty Cracker")
            self.style = Style()
            self.style.theme_use("default")

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

            #load buttons and labels
            self.closeButton= Button(self, text="Close Program", command=self.confirmExit)
            self.closeButton.pack(side=BOTTOM, padx=5, pady=5)
            self.returnToInitUIButton= Button(self, text="Return to Main Menu", command=self.unpackNetworkServerUI_LoadInitUI)
            self.returnToInitUIButton.pack(side=BOTTOM, padx=5, pady=5)
            self.networkServerLabel= Label(self, text="Network Server")
            self.networkServerLabel.pack(side=TOP, padx=5,  pady=5)
            self.selectCrackingMethodLabel= Label(self, text="Select Your Cracking Method")
            self.selectCrackingMethodLabel.pack(side=TOP, padx=5, pady=5)
            self.dictionaryCrackingMethodButton= Button(self, text="Dictionary", command=self.unpackNetworkServerUI_LoadNetworkDictionaryUI)
            self.dictionaryCrackingMethodButton.pack(side=TOP, padx=5, pady=5)
            self.bruteForceCrackingMethodButton= Button(self, text="Brute-Force (default)", command=self.unpackNetwrokServerUI_LoadNetworkBruteForceUI)
            self.bruteForceCrackingMethodButton.pack(side=TOP, padx=5, pady=5)
            self.rainbowTableCrackingMethodButton= Button(self, text="Rainbow Table", command=self.unpackNetworkServerUI_LoadNetworkRainbowTableUI)
            self.rainbowTableCrackingMethodButton.pack(side=TOP, padx=5, pady=5)
        except Exception as inst:
            print "============================================================================================="
            print "GUI ERROR: An exception was thrown in networkServerUI definition Try block"
            #the exception instance
            print type(inst)
            #srguments stored in .args
            print inst.args
            #_str_ allows args tto be printed directly
            print inst
            print "============================================================================================="
示例#18
0
    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)
示例#19
0
    def networkClientUI(self):
        try:
            self.parent.title("Mighty Cracker")
            self.style = Style()
            self.style.theme_use("default")

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

            #load buttons and labels
            self.closeButton= Button(self, text="Close Program", command=self.confirmExit)
            self.closeButton.pack(side=BOTTOM, padx=5, pady=5)
            self.returnToInitUIButton= Button(self, text="Return to Main Menu", command=self.unpackNetworkClientUI_LoadInitUI)
            self.returnToInitUIButton.pack(side=BOTTOM, padx=5, pady=5)
            self.networkClientLabel= Label(self, text="Network Client")
            self.networkClientLabel.pack(side=TOP, padx=5, pady=5)
            self.insertServerIPLabel= Label(self, text="Enter in the Server's IP:")
            self.insertServerIPLabel.pack(side=TOP, padx=5, pady=5)
            self.insertServerIPTextfield= Entry(self, bd=5)
            self.insertServerIPTextfield.pack(side=TOP, padx=5, pady=5)
            #TODO allow right click for pasting into box
            self.startClientButton= Button(self, text="Start Client", command=lambda: self.startClient(str(self.insertServerIPTextfield.get())))
            self.startClientButton.pack(side=TOP, padx=5, pady=5)
        except Exception as inst:
            print "============================================================================================="
            print "GUI ERROR: An exception was thrown in networkClientUI definition Try block"
            #the exception instance
            print type(inst)
            #srguments stored in .args
            print inst.args
            #_str_ allows args tto be printed directly
            print inst
            print "============================================================================================="
示例#20
0
文件: comm.py 项目: angelalonso/comm
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
示例#21
0
文件: view.py 项目: adamchainz/bugjar
    def _setup_button_toolbar(self):
        '''
        The button toolbar runs as a horizontal area at the top of the GUI.
        It is a persistent GUI component
        '''

        # Main toolbar
        self.toolbar = Frame(self.root)
        self.toolbar.grid(column=0, row=0, sticky=(W, E))

        # Buttons on the toolbar
        self.run_button = Button(self.toolbar, text='Run', command=self.cmd_run)
        self.run_button.grid(column=0, row=0)

        self.step_button = Button(self.toolbar, text='Step', command=self.cmd_step)
        self.step_button.grid(column=1, row=0)

        self.next_button = Button(self.toolbar, text='Next', command=self.cmd_next)
        self.next_button.grid(column=2, row=0)

        self.return_button = Button(self.toolbar, text='Return', command=self.cmd_return)
        self.return_button.grid(column=3, row=0)

        self.toolbar.columnconfigure(0, weight=0)
        self.toolbar.rowconfigure(0, weight=0)
示例#22
0
            def __init__(self, container, frame, label='', text='', row=0, column=0):
                self.container = container
                self.is_b0 = BooleanVar(container.parent)
                self.is_dw = BooleanVar(container.parent)
                self.column = column
                self.direction = StringVar(container.parent)

                self.label_from = Label(frame, text='from')
                self.text_from = Entry(frame)
                self.text_from.insert(0, text)
                self.button_file_from = Button(frame, text='...', command=lambda:filenameDialog_text(self.text_from))
                self.button_rm = Button(frame, text='remove', command=self.click_remove)
                self.radio_ap = Radiobutton(frame, text='AP', variable=self.direction, value='AP', command=self.set_direction)
                self.radio_pa = Radiobutton(frame, text='PA', variable=self.direction, value='PA', command=self.set_direction)

                self.label_to = Label(frame, text='to')
                self.text_to = Entry(frame)
                #self.text_to.insert(0, text)
                self.button_file_to = Button(frame, text='Gen', command=self.set_filename_to)
                self.check_b0 = Checkbutton(frame, text='B0',   variable=self.is_b0)
                self.check_dw = Checkbutton(frame, text='DWI',  variable=self.is_dw)

                self.button_up = Button(frame, text='up', width=3, command=self.click_up)
                self.button_dn = Button(frame, text='down', width=3, command=self.click_dn)

                self.row = -1
                self.change_row(row)
                if text != '':
                    self.set_appa()
                    self.set_filename_to()
示例#23
0
 def initializeComponents(self):
     self.boxValue = StringVar()
     self.boxValue.trace('w', \
         lambda name, index, mode, \
         boxValue = self.boxValue : \
         self.box_valueEditted(boxValue))
         
     self.box = Combobox(self,\
         justify = 'left',\
         width = 50, \
         textvariable = self.boxValue,\
     )
     self.box.pack(side = 'left',expand = 1, padx = 5, pady = 5)
     self.box.bind('<<ComboboxSelected>>',self.box_selected)
     self.box.bind('<Return>',self.box_returned)
     
     self.importButton = Button(self, \
         text = "Import", \
         command = self.importButton_clicked,\
     )
     self.importButton.pack(side = 'left',expand = 1)
     
     self.cmd_str = StringVar(None,"Prefix Only")
     self.switchButton = Button(self, \
         textvariable = self.cmd_str, \
         command = self.switchButton_clicked, \
     )
     self.switchButton.pack(side = 'right', padx = 5, pady = 5)
示例#24
0
    def networkModeUI(self):
        try:
            self.parent.title("Mighty Cracker")
            self.style = Style()
            self.style.theme_use("default")

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

            #load buttons and labels
            self.closeButton= Button(self, text="Close Program", command=self.confirmExit)
            self.closeButton.pack(side=BOTTOM, padx=5, pady=5)
            self.returnToInitUIButton= Button(self, text="Return to Main Menu", command=self.unpackNetworkModeUI_LoadInitUI)
            self.returnToInitUIButton.pack(side=BOTTOM, padx=5, pady=5)
            self.networkModeLabel= Label(self, text="Network Mode: Server/Client Selection Screen")
            self.networkModeLabel.pack(side=TOP, padx=5, pady=5)
            self.selectNetworkModuleLabel= Label(self, text="Select Server or Client")
            self.selectNetworkModuleLabel.pack(side=TOP, padx=5, pady=5)
            self.serverModuleButton= Button(self, text="I am the Server", command= self.unpackNetworkModeUI_LoadNetworkServerUI)
            self.serverModuleButton.pack(side=TOP, padx=5, pady=5)
            self.clientModuleButton= Button(self, text="I am a Client", command= self.unpackNetworkModeUI_LoadNetworkClientUI)
            self.clientModuleButton.pack(side=TOP, padx=5, pady=5)

        except Exception as inst:
            print "============================================================================================="
            print "GUI ERROR: An exception was thrown in networkModeUI definition Try block"
            #the exception instance
            print type(inst)
            #srguments stored in .args
            print inst.args
            #_str_ allows args tto be printed directly
            print inst
            print "============================================================================================="
示例#25
0
class MyButton:
#Класс для улучшения читаемости кода однотипных элементов кнопок.
    def __init__(self, place_class, string_class, command_class):
#При создании принимается место прикрепления виджета, строковое значение для надписи
#и строковое для установления команды при нажатии.
        self.button_class = Button(place_class, width = 30, text = string_class, command = command_class)
        self.button_class.pack(side = LEFT)
示例#26
0
 def __init__(self, searcher, master=None):
     """
     Creates a window with a quit button and a ListFrame
     for each search term list, all linked to the given searcher.
     """
     Frame.__init__(self, master)
     self.pack()
     self.exit = Button(self)
     self.exit['text'] = "Quit"
     self.exit['command'] = self.quit
     self.exit.grid(row=0)
     self.hashtags = ListFrame("Hashtags",
                               searcher.add_hashtag,
                               searcher.remove_hashtag,
                               master=self)
     self.hashtags.grid(row=1, column=0, padx=5)
     self.users = ListFrame("Users",
                            searcher.add_user,
                            searcher.remove_user,
                            master=self)
     self.users.grid(row=1, column=1, padx=5)
     self.excluded_words = ListFrame("Excluded Words",
                                     searcher.exclude_word,
                                     searcher.remove_excluded_word,
                                     master=self)
     self.excluded_words.grid(row=1, column=2, padx=5)
     self.excluded_words = ListFrame("Excluded Users",
                                     searcher.exclude_user,
                                     searcher.remove_excluded_user,
                                     master=self)
     self.excluded_words.grid(row=1, column=3, padx=5)
 def __init__(self, parent, controller):
     Frame.__init__(self, parent)
     self.controller = controller
     label = Label(self, text="About", font=TITLE_FONT, justify=CENTER, anchor=CENTER)
     label.pack(side="top", fill="x", pady=10)
     label_2 = Label(self, text=
     """        Frogs vs Flies is a cool on-line multi-player game.
     It consists of hungry frogs, trying to catch some darn
     tasty flies to eat and not starve to death, and terrified,
     but playful flies that try to live as long as possible 
     to score points by not being eaten by nasty frogs.
     ----------------------------------------------------------------------------------------
     When the game has been selected or created, and your
     class selected, click in the game field to start feeling your
     limbs. To move, use your keyboard's arrows.
     By this point, you should know where they are located, 
     don't you? Great! Now you can start playing the game!
     ----------------------------------------------------------------------------------------
     Frogs, being cocky little things, have the ability to
     do a double jump, holding SHIFT while moving with cursors.
     And flies, being so fly, that the air can't catch up with
     them, have a greater field of view, so they can see frogs
     before they can see them.
     ----------------------------------------------------------------------------------------
     Have a wonderful time playing this awesome game!
     ----------------------------------------------------------------------------------------
     
     Created by Kristaps Dreija and Egils Avots in 2015 Fall
     """, font=ABOUT_FONT, anchor=CENTER, justify=CENTER)
     label_2.pack()
     button1 = Button(self, text="\nBack\n", command=lambda: controller.show_frame("StartPage"))
     button1.pack(ipadx=20,pady=10)
示例#28
0
    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()
示例#29
0
    def __init__(self, parent):
        Frame.__init__(self, parent)

        self.parent = parent

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

        output_frame = Frame(self, relief = RIDGE, borderwidth = 1)
        output_frame.pack(anchor = N, fill = BOTH, expand = True)

        output_text = ScrolledText(output_frame)
        self.output_text = output_text
        output_text.pack(fill = BOTH, expand = True)

        input_frame = Frame(self, height = 32)
        input_frame.pack(anchor = S, fill = X, expand = False)

        user_label = Label(input_frame, text = "Enter username:"******"Judge!", command = lambda: judge(user_entry.get(), self))
        judge_button.pack(side = RIGHT)
        user_entry = Entry(input_frame)
        user_entry.pack(fill = X, padx = 5, pady = 5, expand = True)

        self.pack(fill = BOTH, expand = True)
示例#30
0
def showHighscores():
    # get top 5 scores
    arr = session.query(Highscores).all()

    for i in range(len(arr)):
        for j in range(i, len(arr)):
            if (arr[i].score > arr[j].score):
                arr[i], arr[j] = arr[j], arr[i]

    top = Toplevel()
    top.title('Highscores')
    msg = Message(top, text='Top 5 Leaderboard:')
    msg.pack
    count = 1
    for i in range(5):
        text = str(count)
        text += '. '
        text += str(arr[i].name)
        text += ': '
        text += str(arr[i].score)
        label = Label(top, text=text)
        label.pack()
        count += 1

    button = Button(top, text='Dismiss', command=top.destroy)
    button.pack()
    top.geometry('%dx%d+%d+%d' % (200, 200, 600, 300))
示例#31
0
 def add_buttons(fr):
     but_fr = Frame(fr)
     Button(but_fr, text='Clear List', command=lambda : clear_all()) \
         .pack(side=LEFT, padx=5, pady=2)
     Button(but_fr, text='Refresh', command=lambda : show_all()) \
         .pack(side=LEFT, padx=5, pady=2)
     but_fr.pack()
示例#32
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")
示例#33
0
    def initUI(self):
        self.frame_top = Frame(self)
        self.frame_graph = MplCanvas(self)
        self.frame_bottom = Frame(self)

        Label(self.frame_top, text='Z = ').pack(side=LEFT)
        self.spin_z = Spinbox(self.frame_top,
                              from_=0,
                              to=self.shape[2] - 1,
                              increment=1,
                              command=self.change_z)
        self.spin_z.pack(side=LEFT)
        self.make_checkbox(self.frame_bottom, width=4)

        Label(self.frame_top, text='   CSV').pack(side=LEFT)
        self.txt_filename_csv = Entry(self.frame_top)
        self.txt_filename_csv.pack(side=LEFT)
        self.button_read = Button(self.frame_top,
                                  text='Read',
                                  command=self.run_read)
        self.button_read.pack(side=LEFT)
        self.button_save = Button(self.frame_top,
                                  text='Save',
                                  command=self.run_save)
        self.button_save.pack(side=LEFT)

        Label(self.frame_top, text='   ').pack(side=LEFT)
        button_reset = Button(self.frame_top, text='Reset',
                              command=self.reset).pack(side=LEFT)

        self.frame_top.pack(side=TOP)
        self.frame_graph.get_tk_widget().pack(fill=BOTH, expand=TRUE)
        self.frame_bottom.pack(fill=BOTH, expand=TRUE)
        self.pack(fill=BOTH, expand=True)
示例#34
0
文件: alog.py 项目: da4089/alog
    def init_ui(self):
        self.parent.title("Activity Logger")
        self.parent.focusmodel("active")
        
        self.style = Style()
        self.style.theme_use("aqua")

        self.combo_text = StringVar()
        cb = self.register(self.combo_complete)
        self.combo = Combobox(self,
                              textvariable=self.combo_text,
                              validate="all",
                              validatecommand=(cb, '%P'))

        self.combo['values'] = ["Food", "Email", "Web"]
        self.combo.pack(side=TOP, padx=5, pady=5, fill=X, expand=0)

        #self.entry = Text(self, bg="white", height="5")
        #self.entry.pack(side=TOP, padx=5, pady=5, fill=BOTH, expand=1)
        
        self.pack(fill=BOTH, expand=1)
        self.centre()

        self.ok = Button(self, text="Ok", command=self.do_ok)
        self.ok.pack(side=RIGHT, padx=5, pady=5)

        self.journal = Button(self, text="Journal", command=self.do_journal)
        self.journal.pack(side=RIGHT, padx=5, pady=5)

        self.exit = Button(self, text="Exit", command=self.do_exit)
        self.exit.pack(side=RIGHT, padx=5, pady=5)
示例#35
0
    def context(self):
        if self.variable.get() == "Select Arcana":
            return
        levs = []
        for x in range(1, 11):
            levs.append("Level " + str(x))
        self.level.set(levs[0])
        self.levelOM = OptionMenu(self, self.level, *levs)
        self.levelOM.grid(row=1, column=2, columnspan=2)

        self.angs = []
        try:
            tempLink = json_reader.readLink(self.variable.get())
            print tempLink
            print self.variable.get()
            for decon in tempLink["cutscenes"]:
                self.angs.append("Angle " +
                                 str(decon)[str(decon).index("_") + 1:])
        except:
            pass
        if not self.angs:
            self.angs.append("No angles")
        self.angle.set(self.angs[0])
        self.angleOM = OptionMenu(self, self.angle, *self.angs)
        self.angleOM.grid(row=2, column=2, columnspan=2)

        self.addAngB = Button(self, text="Add Angle", command=self.addAngle)
        self.addAngB.grid(row=3, column=2)

        self.newAng = Text(self, height=1, width=5)
        self.newAng.grid(row=3, column=3)

        self.go = Button(self, text="Go", command=self.begin)
        self.go.grid(row=4, column=2, columnspan=2)
示例#36
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"})
示例#37
0
 def showLoading(self):
     self.attemptedMarkov = True
     popup = Toplevel()
     text = Message(popup, text="The Markov Generator is still loading!\n\nText will show up when loaded!")
     text.pack()
     closePop = Button(popup, text="Okay!", command=popup.destroy)
     closePop.pack()  
示例#38
0
    def __init__(self, name, add_handler, remove_handler, master=None):
        """
        Creates a ListFrame with the given name as its title.

        add_handler and remove_handler are functions to be called
        when items are added or removed, and should relay the information
        back to the Searcher (or whatever object actually uses the list).
        """
        LabelFrame.__init__(self, master)
        self['text'] = name
        self.add_handler = add_handler
        self.remove_handler = remove_handler
        self.list = Listbox(self)
        self.list.grid(row=0, columnspan=2)
        # Tkinter does not automatically close the right-click menu for us,
        # so we must close it when the user clicks away from the menu.
        self.list.bind("<Button-1>", lambda event: self.context_menu.unpost())
        self.list.bind("<Button-3>", self.open_menu)
        self.context_menu = Menu(self, tearoff=0)
        self.context_menu.add_command(label="Remove", command=self.remove)
        self.input = Entry(self)
        self.input.bind("<Return>", lambda event: self.add())
        self.input.grid(row=1, columnspan=2)
        self.add_button = Button(self)
        self.add_button['text'] = "Add"
        self.add_button['command'] = self.add
        self.add_button.grid(row=2, column=0, sticky=W + E)
        self.remove_button = Button(self)
        self.remove_button['text'] = "Remove"
        self.remove_button['command'] = self.remove
        self.remove_button.grid(row=2, column=1, sticky=W + E)
 def __init__(cls, master):
     cls.master = master
     cls.master.configure(background='#8A002E')
     cls.img = ImageTk.PhotoImage(Image.open("logo4.jpg"))
     cls.imglabel = Label(cls.master, image=cls.img).grid(row=0, column=3)
     cls.master.wm_title("System Configuration")
     cls.names = cls.ReadTable()
     Label(cls.master,
           background='#8A002E',
           foreground="white",
           font=("Purisa", 12),
           text="Subject|    Student Name|   Marks(%) ").grid(row=1,
                                                              column=0)
     i = 2
     for x in cls.names:
         Label(cls.master,
               background='#8A002E',
               foreground="white",
               font=("Purisa", 16),
               text=x).grid(row=int(i), column=0)
         i = i + 1
     Button(cls.master, text='Back', command=cls.Back).grid(row=7,
                                                            column=0,
                                                            sticky=W,
                                                            pady=4)
     Button(cls.master, text='HELP', command=cls.HelpCon).grid(row=7,
                                                               column=1,
                                                               sticky=W,
                                                               pady=4)
     Button(cls.master, text='Quit', command=cls.master.quit).grid(row=7,
                                                                   column=2,
                                                                   sticky=W,
                                                                   pady=4)
示例#40
0
    def createWidgets(self):
        self.mainFrame = Frame(self.parent)
        Label(self.mainFrame, text='2048 Game', font=(",30"),
              fg="#2980b9").pack(padx=20, pady=20)
        f1 = Frame(self.mainFrame)
        Label(f1, text='Grid').pack(side=LEFT, padx=5)
        Combobox(f1, textvariable=self.grid).pack(side=LEFT, padx=50)
        Button(f1, text='Play', command=self.play).pack(side=LEFT, padx=5)
        f1.pack(pady=10)

        self.winFrame = Frame(self.parent)
        Label(self.winFrame, text=' you win!', font=('', 30),
              fg='#e74c3c').pack(padx=20, pady=10)
        Label(self.winFrame,
              textvariable=self.moves,
              font=('', 30),
              fg='#e74c3c').pack()
        f2 = Frame(self.winFrame)
        Button(f2, text='play again', command=self.play).pack(side=LEFT,
                                                              padx=5)
        Button(f2, text='Cancel', command=self.showMainFrame).pack(side=LEFT,
                                                                   padx=5)
        f2.pack(pady=10)

        self.gameOverFrame = Frame(self.parent)
        Label(self.gameOverFrame,
              text='Gameover!',
              font=('', 30),
              fg='#e74c3c').pack(padx=20, pady=10)
        f2 = Frame(self.gameOverFrame)
        Button(f2, text='play again', command=self.play).pack(side=LEFT,
                                                              padx=5)
        Button(f2, text='Cancel', command=self.showMainFrame).pack(side=LEFT,
                                                                   padx=5)
        f2.pack(pady=10)
示例#41
0
    def initUi( self ):
        self.parent.title( "Supply handler" )
        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 )

        self.openBtn = Button( self, text="Compile script", command=self.openFirmwareSource )
        self.openBtn.grid( row=0, column=0, rowspan=1, columnspan=1, sticky=W+N )

        self.flashBtn = Button( self, text="Load script", command=self.flashFirmware )
        self.flashBtn.grid( row=0, column=1, rowspan=1, columnspan=1, sticky=W+N )

        self.dfuBtn = Button( self, text="Firmware upgrade", command=self.dfuFirmware )
        self.dfuBtn.grid( row=0, column=2, rowspan=1, columnspan=1, sticky=W+N )

        self.helpBtn = Button( self, text="Help", command=self.openHelp )
        self.helpBtn.grid( row=0, column=3, rowspan=1, columnspan=1, sticky=W+N )

        self.txt = Text( self )
        self.txt.grid( row=2, column=0, rowspan=5, columnspan=4, sticky=E+W+S+N )
示例#42
0
文件: comm.py 项目: angelalonso/comm
    def initUI(self):

        self.entries_found = []

        self.parent.title("Search your command cards")
        self.style = Style()
        self.style.theme_use("default")        
        self.pack()
        
        self.input_title = Label(self, text="Enter your command below")
        self.input_title.grid(row=0, columnspan=2)
        self.input_box = Entry(self, width=90)
        self.input_box.grid(row=1, column=0)
        self.input_box.focus()
        self.input_box.bind("<Key>", self.onUpdateSearch)
        self.search_btn = Button(self, text="Search", command=self.onSearch)
        self.search_btn.grid(row=1, column=1)
        self.output_box = Treeview(self, columns=("Example"))
        ysb = Scrollbar(self, orient='vertical', command=self.output_box.yview)
        xsb = Scrollbar(self, orient='horizontal', command=self.output_box.xview)
        self.output_box.configure(yscroll=ysb.set, xscroll=xsb.set)
        self.output_box.heading('Example', text='Example', anchor='w')
        self.output_box.column("#0",minwidth=0,width=0, stretch=NO)
        self.output_box.column("Example",minwidth=0,width=785)
        self.output_box.bind("<Button-1>", self.OnEntryClick)
        self.output_box.grid(row=3, columnspan=2)
        self.selected_box = Text(self, width=110, height=19)
        self.selected_box.grid(row=4, columnspan=2)
        self.gotoadd_btn = Button(self, text="Go to Add", command=self.onGoToAdd)
        self.gotoadd_btn.grid(row=5)
示例#43
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', '.*')]
示例#44
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)
    def initUI(self):

        Config.read("config.ini")
        Config.sections()
        derecha = ConfigSectionMap("Movimientos")['derecha']
        izquierda = ConfigSectionMap("Movimientos")['izquierda']
        disparo = ConfigSectionMap("Movimientos")['disparo']
        salto = ConfigSectionMap("Movimientos")['salto']

        derecha=int(derecha)
        izquierda=int(izquierda)
        disparo=int(disparo)
        salto=int(salto)

        self.parent.title("Place of dead - [Configuration]")
        self.style = Style()
        #self.style.theme_use("default")
        self.style.configure('My.TFrame', background='gray')
        #Layouts
        frame1 = Frame(self)
        frame1.pack(fill=Y)
        frame2 = Frame(self)
        frame2.pack(fill=Y)
        frame3 = Frame(self)
        frame3.pack(fill=Y)
        frame4 = Frame(self)
        frame4.pack(fill=Y)
        frame5 = Frame(self)
        frame5.pack(fill=Y)
        frame6 = Frame(self)
        frame6.pack(fill=Y)

        self.pack(fill=BOTH, expand=1)
        self.labela = Label(frame2, text="Movimiento a la derecha: ")#, textvariable=self.var)
        self.labela.pack(side=LEFT)
        derechae = Entry(frame2,width=9)
        derechae.insert(END, str(retornarletra(derecha)))
        derechae.pack(side=LEFT,padx=1, pady=1, expand=True)

        self.labelb = Label(frame3, text="Movimiento a la derecha: ")#, textvariable=self.var)
        self.labelb.pack(side=LEFT)
        izquierdae = Entry(frame3,width=9)
        izquierdae.insert(END, str(retornarletra(izquierda)))
        izquierdae.pack(side=LEFT,padx=1, pady=1, expand=True)

        self.labelc = Label(frame4, text="Salto: ")#, textvariable=self.var)
        self.labelc.pack(side=LEFT)
        saltoe = Entry(frame4,width=9)
        saltoe.insert(END, str(retornarletra(salto)))
        saltoe.pack(side=LEFT,padx=1, pady=1, expand=True)

        self.labeld = Label(frame5, text="Ataque: ")#, textvariable=self.var)
        self.labeld.pack(side=LEFT)
        disparoe = Entry(frame5,width=9)
        disparoe.insert(END, str(retornarletra(disparo)))
        disparoe.pack(side=LEFT,padx=1, pady=1, expand=True)

        okButton = Button(frame6, text="Save", command=lambda: self.save(derechae.get(),izquierdae.get(),saltoe.get(),disparoe.get()))
        okButton.pack(side=RIGHT)
 def __initializeComponents(self):
     self.imageCanvas = Canvas(master=self, width=imageCanvasWidth,
                               height=windowElementsHeight, bg="white")
     self.imageCanvas.pack(side=LEFT, padx=(windowPadding, 0),
                           pady=windowPadding, fill=BOTH)
     
     self.buttonsFrame = Frame(master=self, width=buttonsFrameWidth,
                               height=windowElementsHeight)
     self.buttonsFrame.propagate(0)
     self.loadFileButton = Button(master=self.buttonsFrame,
                                  text=loadFileButtonText, command=self.loadFileButtonClick)
     self.loadFileButton.pack(fill=X, pady=buttonsPadding);
     
     self.colorByLabel = Label(self.buttonsFrame, text=colorByLabelText)
     self.colorByLabel.pack(fill=X)
     self.colorByCombobox = Combobox(self.buttonsFrame, state=DISABLED,
                                     values=colorByComboboxValues)
     self.colorByCombobox.set(colorByComboboxValues[0])
     self.colorByCombobox.bind("<<ComboboxSelected>>", self.__colorByComboboxChange)
     self.colorByCombobox.pack(fill=X, pady=buttonsPadding)
     self.rejectedValuesPercentLabel = Label(self.buttonsFrame, text=rejectedMarginLabelText)
     self.rejectedValuesPercentLabel.pack(fill=X)
     self.rejectedValuesPercentEntry = Entry(self.buttonsFrame)
     self.rejectedValuesPercentEntry.insert(0, defaultRejectedValuesPercent)
     self.rejectedValuesPercentEntry.config(state=DISABLED)
     self.rejectedValuesPercentEntry.pack(fill=X, pady=buttonsPadding)        
     
     self.colorsSettingsPanel = Labelframe(self.buttonsFrame, text=visualisationSettingsPanelText)
     self.colorsTableLengthLabel = Label(self.colorsSettingsPanel, text=colorsTableLengthLabelText)
     self.colorsTableLengthLabel.pack(fill=X)
     self.colorsTableLengthEntry = Entry(self.colorsSettingsPanel)
     self.colorsTableLengthEntry.insert(0, defaultColorsTableLength)
     self.colorsTableLengthEntry.config(state=DISABLED)
     self.colorsTableLengthEntry.pack(fill=X)
     self.scaleTypeLabel = Label(self.colorsSettingsPanel, text=scaleTypeLabelText)
     self.scaleTypeLabel.pack(fill=X)
     self.scaleTypeCombobox = Combobox(self.colorsSettingsPanel, state=DISABLED,
                                       values=scaleTypesComboboxValues)
     self.scaleTypeCombobox.set(scaleTypesComboboxValues[0])
     self.scaleTypeCombobox.bind("<<ComboboxSelected>>", self.__scaleTypeComboboxChange)
     self.scaleTypeCombobox.pack(fill=X)
     self.colorsTableMinLabel = Label(self.colorsSettingsPanel, text=colorsTableMinLabelText)
     self.colorsTableMinLabel.pack(fill=X)
     self.colorsTableMinEntry = Entry(self.colorsSettingsPanel)
     self.colorsTableMinEntry.insert(0, defaultColorsTableMin)
     self.colorsTableMinEntry.config(state=DISABLED)
     self.colorsTableMinEntry.pack(fill=X)
     self.colorsTableMaxLabel = Label(self.colorsSettingsPanel, text=colorsTableMaxLabelText)
     self.colorsTableMaxLabel.pack(fill=X)
     self.colorsTableMaxEntry = Entry(self.colorsSettingsPanel)
     self.colorsTableMaxEntry.insert(0, defaultColorsTableMax)
     self.colorsTableMaxEntry.config(state=DISABLED)
     self.colorsTableMaxEntry.pack(fill=X)
     self.colorsSettingsPanel.pack(fill=X, pady=buttonsPadding)
     
     self.redrawButton = Button(master=self.buttonsFrame, text=redrawButtonText,
                                state=DISABLED, command=self.__redrawButtonClick)
     self.redrawButton.pack(fill=X, pady=buttonsPadding)
     self.buttonsFrame.pack(side=RIGHT, padx=windowPadding, pady=windowPadding, fill=BOTH)
示例#47
0
    def initUI(self,parent):
        self.parent.title("Quit Button")
        self.style= Style()
        self.style.theme_use("default")

        self.pack(fill=BOTH,expand=1)
        quitbutton=Button(self,text="Quit",command=parent.destroy)
        quitbutton.place(x=50,y=50)
示例#48
0
文件: knn.py 项目: tifoit/knn-1
    def init_ui(self):
        self.parent.title("knn - Classification")
        self.style.theme_use("default")

        self.pack(fill=BOTH, expand=1)
        self.center_window()
        quit_button = Button(self, text="Close", command=self.quit)
        quit_button.place(x=50, y=50)
示例#49
0
文件: knn.py 项目: tifoit/knn-1
    def init_ui(self):
        self.parent.title("knn - Classification")
        self.style.theme_use("default")

        self.pack(fill=BOTH, expand=1)
        self.center_window()
        quit_button = Button(self, text="Close", command=self.quit)
        quit_button.place(x=50, y=50)
示例#50
0
 def initUI(self):
     self.parent.title('Simple')
     self.style = Style()
     self.style.theme_use('default')
     self.pack(fill=BOTH, expand=1)
     # self.centerWindow()
     quitButton = Button(self, text='Quit', command=self.quit)
     quitButton.place(x=50, y=50)
示例#51
0
 def initUI(self):
   
     self.parent.title("Simple")
     self.pack(fill=BOTH, expand=1)
     self.centerWindow()
     
     quitButton = Button(self, text="Quit", command=self.quit)
     quitButton.place(x=50, y=50)
    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)
示例#53
0
    def initUI(self):
        scrollbar = Scrollbar(self)
        scrollbar.pack(side=RIGHT, fill=Y)
        dirLabel = Label(
            self,
            text="Directory Path of all files",
        )
        dirLabel.pack(side=TOP)
        fileText = Entry(self, text="test", width=90)
        fileText.pack(side=TOP)
        outputLabel = Listbox(self, yscrollcommand=scrollbar.set, width=90)
        outputLabel.pack(side=TOP)
        var = StringVar(self)
        var.set("format type")  # initial value
        menu = OptionMenu(self, var, "png", "jpg")
        menu.pack(side=TOP)
        self.parent.title("Bulk Image Converter")
        self.style = Style()
        #self.style.theme_use("clam")
        frame = Frame(self, relief=RAISED)
        frame.pack(fill=NONE, expand=True)
        self.pack(fill=BOTH, expand=True)

        def image(text, var):
            from PIL import Image
            import glob, os
            import sys
            #/Users/augustus/Pictures/iep/
            filepath = text

            print('working....\n')
            if not os.path.exists(filepath):
                print('not a file path\n' + filepath)

            for file in glob.glob(filepath + "/*.*"):
                im = Image.open(file)
                file = file.strip("../")
                file = file.strip(".jpg")
                file = file.strip(".jpeg")
                file = file.strip(".png")
                file = file.strip(".tiff")
                file = file.strip(filepath)
                if not os.path.exists(filepath + "output"):
                    os.makedirs(filepath + "output")
                print(file)
                outputLabel.insert(END, file)
                if var == "jpg":
                    im.save(filepath + "output/" + file + ".jpg", "JPEG")
                elif var == "png":
                    im.save(filepath + "output/" + file + ".png", "PNG")
                else:
                    im.save(filepath + "output/" + file + ".jpg", "JPEG")

        def fileTextDef():
            image(fileText.get(), var.get())

        okButton = Button(self, text="OK", command=fileTextDef)
        okButton.pack(side=RIGHT)
示例#54
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)
    def initUI(self):
        self.parent.title("Test the Gauss point")
        self.pack(fill=BOTH, expand=True)
        self.fields = \
                'bulk_modulus', \
                'scale_hardening', \
                'max_stress_in', \
                'increment_strain', \
                'Nloop', \
                'initial_confinement', \
                'reference_pressure', \
                'modulus_n', \
                'cohesion', \
                'RMC_shape_k', \
                'dilation_angle_eta', \
                'diletion_scale'

        default_values = \
                        '1E7', \
                        '1E3', \
                        '3E4', \
                        '1E-4', \
                        '2', \
                        '1E5', \
                        '1E5', \
                        '0.7', \
                        '0.0', \
                        '1.0', \
                        '1.0', \
                        '1.0'
        # ==================
        # Entries for User input:
        self.entries = []
        for idx, field in enumerate(self.fields):
            row = Frame(self)
            row.pack(fill=X)
            labl = Label(row, text=field, width=30)
            labl.pack(side=LEFT, padx=5, pady=5)
            entry = Entry(row)
            entry.insert(END, default_values[idx])
            entry.pack(fill=X, padx=5, expand=True)
            self.entries.append((field, entry))
            # print field

        # ==================
        # Button for calculation
        frameButtonCalc = Frame(self)
        frameButtonCalc.pack(fill=X)
        calcButton = Button(frameButtonCalc,
                            text="calculate",
                            command=self.calculate)
        calcButton.pack(side=LEFT, padx=5, pady=5)

        # ==================
        # Raw Frame for plot
        self.canvasFrame = Frame(self)
        self.canvasFrame.pack(fill=BOTH, expand=True)
示例#56
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)
示例#57
0
    def initUI(self):
        self.parent.title("Quit button")
        self.style = Style()
        self.style.theme_use("default")

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

        quitButton = Button(self, text="Quit", command=self.quit)
        quitButton.place(x=50, y=50)
示例#58
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()