Пример #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
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)
Пример #3
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)
Пример #4
0
    def initUI(self):
        config = ConfigParser.ConfigParser()
        config.read('settings.ini')
        default_sheet = config.get('USER', 'default_spreadsheet')
        self.pack(fill=BOTH, expand=True)
        self.columnconfigure(1, weight=1)
        self.columnconfigure(3, pad=7)

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

        self.lblTsv = Label(self, text="Enter TSV Export:")
        self.lblTsv.grid(sticky=W, pady=4, padx=5)

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

        self.btnSubmit = Button(self, text="Submit", command=self.submit_text)
        self.btnSubmit.grid(row=6, column=4, padx=5)

        self.btnUpload = Button(self, text="Upload to GS", command = self.upload_db)
        self.btnUpload.grid(row=6, column=3, padx=5)

        self.btnCancel = Button(self, command=sys.exit, text="Quit")
        self.btnCancel.grid(row=6, column=2, padx=5)

        self.lblSheet = Label(self, text="Enter google sheets URL:")
        self.lblSheet.grid(row=5, sticky=W, pady=4, padx=4)

        self.sheetUrl = Entry(self)
        self.sheetUrl.grid(row=6, columnspan=2, sticky=W+E, padx=5, pady=5)
        self.sheetUrl.insert(0, default_sheet)
        return
Пример #5
0
    def __init__(self, root):
        super().__init__()
        self.root = root
        self.exception = None

        self.list_string = StringVar()
        self.listbox = Listbox(root,
                               listvariable=self.list_string,
                               font='TkFixedFont',
                               width=30)

        self.write_cache = ''
        self.logfile = None
        self.enable_logging = BooleanVar()
        self.enable_logging_checkbox = Checkbutton(
            root,
            var=self.enable_logging,
            text='Enable logging',
            command=self.enable_logging_changed)

        self.logfile_label = Label(root, text='Logfile name:')
        self.logfile_name = StringVar()
        self.logfile_name_entry = Entry(root, textvar=self.logfile_name)

        self.load()
Пример #6
0
    def initUI(self):
        self.parent.title("simple")

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

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

        self.rowconfigure(0, pad=3)
        self.rowconfigure(4, pad=3)

        entry = Entry(self)
        entry.grid(row=0, columnspan=4, sticky=W + E)

        cls = Button(self, text="Cls")
        cls.grid(row=1, column=0)

        quitbutton = Button(self, text="quit", command=self.parent.destroy)
        quitbutton.grid(row=4, column=0)

        self.var = IntVar()

        cb = Checkbutton(self,
                         text="show title",
                         variable=self.var,
                         command=self.onClick)
        cb.select()
        cb.grid(row=2, column=2)
        self.pack()
Пример #7
0
class CommAdd(Frame):
  
    def __init__(self, parent):
        Frame.__init__(self, parent)   
         
        self.parent = parent        
        self.initUI()
        
    def initUI(self):
        # This should be different if running on Windows....
        content = pyperclip.paste()
        print content  
        self.entries_found = []

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

    def onAddNew(self):

        pass
Пример #8
0
    def initUI(self):
        self.title('CP Noise Parameters')
        self.columnconfigure(0, pad=1)
        self.columnconfigure(1, pad=1)
        self.columnconfigure(2, pad=1)
        self.rowconfigure(0, pad=10)
        self.rowconfigure(1, pad=1)
        self.rowconfigure(2, pad=6)

        label1 = Label(self, text='Corner Frequency [kHz]')
        self.entry_fc = Entry(self, width=8)
        self.entry_fc.insert(END, str(self.parent.cp_fc.get() / 1.0e3))
        label1.grid(row=0, column=0, sticky=W)
        self.entry_fc.grid(row=0, column=1, sticky=W)

        label2 = Label(self, text='Noise slope [dB/dec]')
        self.entry_slope = Entry(self, width=8)
        self.entry_slope.insert(END, str(self.parent.cp_slope.get()))
        label2.grid(row=1, column=0, sticky=W)
        self.entry_slope.grid(row=1, column=1, sticky=W)

        button_OK = Button(self, text='OK', command=self.on_OK, width=10)
        button_Apply = Button(self,
                              text='Apply',
                              command=self.on_Apply,
                              width=10)
        button_Quit = Button(self, text='Quit', command=self.on_Quit, width=10)
        button_OK.grid(row=2, column=0, sticky=W + E + S)
        button_Apply.grid(row=2, column=1, sticky=W + E + S)
        button_Quit.grid(row=2, column=2, sticky=W + E + S)
Пример #9
0
    def initUI(self):
        self.parent.title("simple")

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

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

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

        entry = Entry(self)
        entry.grid(row=0, columnspan=4, sticky=W + E)
        ##        cls = Button(self, text="Cls")
        ##        cls.grid(row=1, column=0)
        label = Label(self, text="hello world")
        label.pack()

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

        quitbutton = Button(self, text="quit", command=self.parent.destroy)
        quitbutton.pack(side=RIGHT)

        self.pack(fill=BOTH, expand=.1)
Пример #10
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")
Пример #11
0
class Example(Frame):
  
    def __init__(self, parent):
        Frame.__init__(self, parent)   
         
        self.parent = parent
        
        self.initUI()
        
    def initUI(self):
      
        self.parent.title("Please enter company name")
        
        Style().configure("TButton", padding=(0, 20, 0, 20), width=60)
        Style().configure("TLabel", padding=(3, 3, 3, 3))
        Style().configure("TEntry", padding=(0, 5, 0, 5))
        self.columnconfigure(0, pad=3)
        self.columnconfigure(1, pad=3)
        self.columnconfigure(2, pad=3)
        self.columnconfigure(3, pad=3)
        
        self.rowconfigure(0, pad=3)
        self.rowconfigure(1, pad=3)
        self.rowconfigure(2, pad=3)
        self.rowconfigure(3, pad=3)
        self.rowconfigure(4, pad=3)
        self.label = Label(self, text="Company Name")
        self.entry = Entry(self)
        self.entry.grid(row=0, columnspan=4, sticky=W+E)
        cls = Button(self, text="OK", command=self.quit)
        cls.grid(row=1, column=0)
        self.pack()
Пример #12
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)
Пример #13
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 __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)
Пример #15
0
class Login(Frame):
    """******** Funcion: __init__ **************
    Descripcion: Constructor de Login
    Parametros:
    self Login
    parent Tk
    Retorno: void
    *****************************************************"""
    def __init__(self, parent):
        Frame.__init__(self, parent)
        self.parent = parent
        self.initUI()


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

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

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

    """******** Funcion: login **************
    Descripcion: Luego que el usuario ingresa su codigo de acceso, hace
                la solicitud al servidor para cargar su cuenta en una
                ventana de tipo Profile
    Parametros:
    self
    Retorno: Retorna...
    *****************************************************"""
    def login(self):
        code = self.codeEntry.get()
        api = InstagramAPI(code)
        raw = api.call_resource('users', 'info', user_id='self')
        data = raw['data']
        self.newWindow = Toplevel(self.parent)
        global GlobalID
        GlobalID = data['id']
        p = Profile(self.newWindow,api,data['id'])
Пример #16
0
    def initUI(self):
      
        self.parent.title("Add Food")
        self.style = Style()
        self.style.theme_use("default")
        self.grid()

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

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

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


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

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

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

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

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

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


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

        cancel_btn = Button(self.parent, text="Cancel",\
            command=self.cancel_food)
        cancel_btn.grid(row=1, column=5)
Пример #17
0
class MainFrame(Frame):    
    def __init__(self, parent):
        Frame.__init__(self, parent)   
        self.parent = parent
        self.initUI()    
              
    def initUI(self):
        self.parent.title("Driver Control Panel")
        self.style = Style()
        self.style.theme_use("default")
        self.pack(fill=BOTH, expand=1)

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

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

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

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

        self.e = Entry(self, font=('Helvetica', '18'))
        self.e.grid(row=4, column=0)
        self.search = Button(self, text="Start")
        self.search.grid(row=6, column=0)   
        
        
        ######### used for debug ##########
        # add vertical space
        self.l2 = Label(self, text="", font=('Helvetica', '14'))
        self.l2.grid(row=5, column=0)
        
        self.turnOnBtn = Button(self, text="Turn On")
        self.turnOnBtn["command"] = self.turnOn 
        self.turnOnBtn.grid(row=6, column=0)    
        
        self.startBtn = Button(self, text="Start")
        self.startBtn["command"] = self.start 
        self.startBtn.grid(row=7, column=0)    
        
        self.turnOffBtn = Button(self, text="Turn Off")
        self.turnOffBtn["command"] = self.turnOff 
        self.turnOffBtn.grid(row=8, column=0)   
        
    def turnOn(self):
        host.enqueue({"SM":"DRIVER_SM", "action":"turnOn", "busId":DRIVERID, "localIP":IP, "localPort":int(PORT)})
        
    def start(self):
        host.enqueue({"SM":"DRIVER_SM", "action":"start", "route":ROUTNO, "direction":"north", "location":(0,0)})
        
    def turnOff(self):
        host.enqueue({"SM":"DRIVER_SM", "action":"turnOff"})    
Пример #18
0
 def add_file_browser(self, f, button_txt, init_txt, r, c, help_txt=''):
     b = Button(f, text=button_txt)
     b.grid(row=r, column=c, sticky=W + E)
     f_var = StringVar()
     f_var.set(init_txt)
     e = Entry(f, textvariable=f_var)
     e.grid(row=r, column=c + 1)
     b.configure(command=lambda: self.browse_file(f_var, b))
     return f_var
Пример #19
0
 def __init__(self, parent, **kwargs):
     """!
     A constructor for the class
     @param self The pointer for the object
     @param parent The parent object for the frame
     @param **kwargs Other arguments as accepted by ttk.Entry
     """
     Entry.__init__(self, parent, **kwargs)
     self.configure(background=DEFAULT_BACKGROUND)
Пример #20
0
 def _add_field(self, frame, index, name):
     self.variables[-1] = StringVar()
     label = Label(frame, text=name)
     label.grid(row=index, column=0, sticky="W", padx=10)
     field = Entry(frame)
     field.grid(row=index,
                column=1,
                sticky="WE",
                textvariable=self.variables[-1])
	def add_file_browser(self, f, button_txt, init_txt , r, c, help_txt=''):
		b = Button(f,text=button_txt)
		b.grid(row=r, column=c, sticky=W+E)
		f_var = StringVar()
		f_var.set(init_txt)
		e = Entry(f, textvariable=f_var)
		e.grid(row=r, column=c+1)
		b.configure(command=lambda: self.browse_file(f_var, b))
		return f_var
Пример #22
0
    def initUI(self):
        self.parent.title("User Control Panel")
        self.style = Style()
        self.style.theme_use("default")
        self.pack(fill=BOTH, expand=1)

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

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

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

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

        self.e = Entry(self, font=('Helvetica', '18'))
        self.e.grid(row=4, column=0)
        self.search = Button(self, text="Search")
        self.search.grid(row=6, column=0)       

        # For second screen (after user searched)
        # add vertical space
        self.l = Label(self, text="", font=('Helvetica', '14'))
        self.l.grid(row=7, column=0)

        self.l = Label(self, text="Pick a bus line", font=('Helvetica', '18'))
        self.l.grid(row=8, column=0)  
        
        self.search = Button(self, text="61A", width=40)
        self.search.grid(row=9, column=0)
        self.search = Button(self, text="61B", width=40)
        self.search.grid(row=10, column=0)
        self.search = Button(self, text="61C", width=40)
        self.search.grid(row=11, column=0)
        
        
        ############## used for debug ################
        self.l2 = Label(self, text="", font=('Helvetica', '14'))
        self.l2.grid(row=12, column=0)
        
        self.turnOnBtn = Button(self, text="Turn On")
        self.turnOnBtn["command"] = self.turnOn 
        self.turnOnBtn.grid(row=13, column=0)    
        
        self.reqBtn = Button(self, text="Request")
        self.reqBtn["command"] = self.request 
        self.reqBtn.grid(row=14, column=0)    
        
        self.turnOffBtn = Button(self, text="Turn Off")
        self.turnOffBtn["command"] = self.turnOff 
        self.turnOffBtn.grid(row=15, column=0)   
Пример #23
0
    def init_ui(self):
        self.parent.title("Information Theory")
        Style().configure("TButton", padding=(0, 5, 0, 5), font='Verdana 10')

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

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

        string_to_search_label = Label(self, text="Search a string: ")
        string_to_search_label.grid(row=0, column=0, rowspan=2)
        self.string_to_search_textfield = Entry(self)
        self.string_to_search_textfield.grid(row=0, column=1, rowspan=2, columnspan=2, sticky=W)
        self.string_to_search_textfield.bind('<Return>', self.get_string_from_textfield)
        self.compression_ratio_text = StringVar()
        self.compression_ratio_text.set('Compression Ratio: ')
        compression_ratio_label = Label(self, textvariable=self.compression_ratio_text).grid(row=0, column=2,
                                                                                             columnspan=4)

        Separator(self, orient=HORIZONTAL).grid(row=1)
        string_to_encode_label = Label(self, text="Encode a string: ")
        string_to_encode_label.grid(row=2, column=0, rowspan=2)
        self.string_to_encode_textfield = Entry(self)
        self.string_to_encode_textfield.grid(row=2, column=1, rowspan=2, columnspan=2, sticky=W)
        self.string_to_encode_textfield.bind('<Return>', self.get_string_from_textfield_to_encode)

        Separator(self, orient=HORIZONTAL).grid(row=3)
        self.area = Text(self)
        self.area.grid(row=4, column=0, columnspan=3, rowspan=1, padx=5, sticky=E + W)
        self.area.config(width=10, height=15)
        self.possible_options_text = StringVar()
        self.possible_options_text.set("Possible Options: ")
        self.possible_options_label = Label(self, textvariable=self.possible_options_text).grid(row=4, column=3,
                                                                                                sticky=N)

        huffman_coding_button = Button(self, text="Huffman",
                                       command=self.huffman_coding_callback).grid(row=5, column=0)
        arithmetic_coding_button = Button(self, text="Arithmetic Coding",
                                          command=self.arithmetic_coding_callback).grid(row=5, column=1)
        dictionary_coding_button = Button(self, text="Dictionary",
                                          command=self.dictionary_coding_callback).grid(row=5, column=2)
        elias_coding_button = Button(self, text="Elias",
                                     command=self.elias_coding_callback).grid(row=5, column=3)
        our_coding_button = Button(self, text="Elemental Coding",
                                   command=self.elemental_coding_callback).grid(row=5, column=4)
        self.pack()
        self.elemental_coding_callback()
Пример #24
0
    def __init__(self):
        self.root = Tk()
        self.root.title(u'登录')
        self.root.resizable(False, False)
        self.root.geometry('+450+250')
        self.sysfont = Font(self.root, size=15)
        self.lb_user = Label(self.root,
                             text=u'用户名:',
                             width=20,
                             height=10,
                             font=("黑体", 15, "bold"))
        self.lb_passwd1 = Label(self.root, text=u'')
        self.lb_passwd = Label(self.root,
                               text=u'密码:',
                               width=20,
                               height=5,
                               font=("黑体", 15, "bold"))
        self.lb_user.grid(row=0, column=0, sticky=W)
        self.lb_passwd1.grid(row=1, column=0, sticky=W)
        self.lb_passwd.grid(row=2, column=0, sticky=W)

        self.en_user = Entry(self.root, font=self.sysfont, width=24)
        self.en_passwd = Entry(self.root, font=self.sysfont, width=24)
        self.en_user.grid(row=0, column=1, columnspan=1)
        self.en_passwd.grid(row=2, column=1, columnspan=1)
        self.en_user.insert(0, u'请输入用户名')
        self.en_passwd.insert(0, u'请输入密码')
        self.en_user.config(
            validate='focusin',
            validatecommand=lambda: self.validate_func('self.en_user'),
            invalidcommand=lambda: self.invalid_func('self.en_user'))
        self.en_passwd.config(
            validate='focusin',
            validatecommand=lambda: self.validate_func('self.en_passwd'),
            invalidcommand=lambda: self.invalid_func('self.en_passwd'))

        self.var = IntVar()
        self.ckb = Checkbutton(self.root,
                               text=u'记住用户名和密码',
                               underline=0,
                               variable=self.var,
                               font=(15))
        self.ckb.grid(row=3, column=0)
        self.bt_print = Button(self.root, text=u'登陆')
        self.bt_print.grid(row=3, column=1, sticky=E, pady=50, padx=10)
        self.bt_print.config(command=self.print_info)

        self.bt_http = Button(self.root, text=u'http登录')
        self.bt_http.grid(row=3, column=2, sticky=E, pady=50, padx=50)
        self.bt_http.config(command=self.http_info)

        self.bt_register = Button(self.root, text=u'注册')
        self.bt_register.grid(row=3, column=3, sticky=E, pady=50, padx=50)
        self.bt_register.config(command=self.register_info)
        self.root.mainloop()
Пример #25
0
    def show(self, line=None):
        '''
        allows preset values
        '''
        self.setup() #base class setup

        self.frame = Frame(self.root)

        # blow out the field every time this is created
        if not self.edit: self.date.set(date.today().strftime("%m/%d/%Y"))
        
        ### dialog content        
        Label(self.frame, text="First Name: ").grid(row=0, sticky=W, ipady=2, pady=2)
        Label(self.frame, text="Middle Initial: ").grid(row=1, sticky=W, ipady=2, pady=2)
        Label(self.frame, text="Last Name: ").grid(row=2, sticky=W, ipady=2, pady=2)
        Label(self.frame, text="Customer Type: ").grid(row=3, sticky=W, ipady=2, pady=2)
        Label(self.frame, text="Date (mm/dd/yyyy): ").grid(row=4, sticky=W, ipady=2, pady=2)

        self.fname_en = Entry(self.frame, width=30, textvariable=self.fname)
        self.mname_en = Entry(self.frame, width=30, textvariable=self.mname)
        self.lname_en = Entry(self.frame, width=30, textvariable=self.lname)
        self.payment_cb = Combobox(self.frame, textvariable=self.payment, width=27,
                                   values=("Drop In", "Punch Card", "Monthly", "Inactive"))
        self.payment_cb.set("Drop In")
        self.date_en = Entry(self.frame, width=30, textvariable=self.date)

        Frame(self.frame, width=5).grid(row=0,column=1,sticky=W)
        
        self.fname_en.grid(row=0,column=2,columnspan=2,sticky=W)
        self.mname_en.grid(row=1,column=2,columnspan=2,sticky=W)
        self.lname_en.grid(row=2,column=2,columnspan=2,sticky=W)
        self.payment_cb.grid(row=3,column=2,columnspan=2,sticky=W)
        self.date_en.grid(row=4,column=2,columnspan=2,sticky=W)
        
        ### buttons
        Button(self.frame, text='Cancel', width=10,
               command=self.wm_delete_window).grid(row=5, column=2, sticky=W, padx=10, pady=3)
        Button(self.frame, text='Submit', width=10,
               command=self.add_customer).grid(row=5, column=3, sticky=W)
        self.frame.pack(padx=10, pady=10)

        self.root.bind("<Return>", self.add_customer)
        self.fname_en.focus_set()

        if line: #preset values
            self.fname.set(line[1])
            self.mname.set(line[2])
            self.lname.set(line[0])
            self.payment_cb.set(line[3])
            self.date.set(line[4].strftime("%m/%d/%Y"))
        
        ### enable from base class
        self.enable()
Пример #26
0
 def add_buttons(fr):
     but_fr = Frame(fr)
     if using_ttk or using_tile:
         ent[0] = Entry(but_fr, width=80)
     else:
         ent[0] = Entry(but_fr, width=80, highlightthickness=3,
                        background=word_bg_color,
                        highlightcolor=highlight_color)
     ent[0].pack(padx=5, pady=2)
     Button(but_fr, text='Clear Display', command=lambda : clear_all()) \
         .pack(pady=2)
     but_fr.pack()
Пример #27
0
    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)
Пример #28
0
    def initUI(self):  # creating gui
        self.frame1 = Frame(self)
        self.frame2 = Frame(self)
        self.frame3 = Frame(self)
        self.frame4 = Frame(self)
        self.frame5 = Frame(self)

        # created multiple frames

        self.label1 = Label(self.frame1,
                            text="COURSE PROGRAM ESTIMATOR",
                            font='Helvetica 25 bold',
                            background="SpringGreen3",
                            foreground="black")
        self.label2 = Label(self.frame1,
                            text="     Training Data: ",
                            font="Times 14")
        self.entry = Entry(self.frame1, width=65)
        self.entry.insert(
            0,
            'https://www.sehir.edu.tr/tr/duyurular/2017-2018-Akademik-Yili-Ders-Programi'
        )
        self.color = Label(
            self.frame1,
            text="                   ",
            background="red",
        )
        self.button = Button(self.frame1,
                             text="Fetch and Train",
                             command=self.fetch)
        self.label3 = Label(self.frame2,
                            text="Individual Courses:",
                            font='Helvetica 10 bold')
        self.label4 = Label(self.frame3,
                            text="     Top 3 Estimates:",
                            font='Helvetica 10 bold')
        self.coursesListbox = Listbox(self.frame2, width=30)
        self.label5 = Label(self.frame4,
                            text=" Accuracy Analysis \nBased on Programs: ",
                            font='Helvetica 10 bold')
        self.programsListbox = Listbox(self.frame4, width=30)
        self.estimatesListbox = Text(self.frame5, width=30, height=10)

        self.scrollbar1 = Scrollbar(self.frame2, orient=VERTICAL)
        self.scrollbar2 = Scrollbar(self.frame4, orient=VERTICAL)
        self.scrollbar3 = Scrollbar(self.frame5, orient=VERTICAL)
        self.scrollbar1.config(command=self.coursesListbox.yview)
        self.scrollbar2.config(comman=self.programsListbox.yview)
        self.scrollbar3.config(command=self.estimatesListbox.yview)
        self.coursesListbox.config(yscrollcommand=self.scrollbar1.set)
        self.programsListbox.config(yscrollcommand=self.scrollbar2.set)
        self.estimatesListbox.config(yscrollcommand=self.scrollbar3.set)
Пример #29
0
    def initUI(self):

        self.parent.title("Review")
        self.pack(fill=BOTH, expand=True)
        labelfont20 = ('Roboto', 20, 'bold')
        labelfont12 = ('Roboto', 12, 'bold')

        frame0 = Frame(self)
        frame0.pack()

        lbl0 = Label(frame0, text="Hi USER")
        lbl0.config(font=labelfont20)
        lbl0.pack(padx=5, pady=5)
        lbl00 = Label(frame0, text="Search here")
        lbl00.config(font=labelfont12)
        lbl00.pack(padx=5, pady=5)

        frame1 = Frame(self)
        frame1.pack()

        lbl1 = Label(frame1, text="min %", width=9)
        lbl1.pack(side=LEFT, padx=7, pady=5)

        self.entry1 = Entry(frame1, width=20)
        self.entry1.pack(padx=5, expand=True)

        frame6 = Frame(self)
        frame6.pack()
        closeButton = Button(frame6,
                             text="Get Names",
                             width=12,
                             command=self.getDate)
        closeButton.pack(padx=5, pady=5)

        frame7 = Frame(self)
        frame7.pack()
        closeButton1 = Button(frame7,
                              text="Open in excel",
                              width=15,
                              command=self.openDate)
        closeButton1.pack(padx=5, pady=5)

        frame000 = Frame(self)
        frame000.pack()
        self.lbl000 = Label(frame000, text=" ")
        self.lbl000.config(font=labelfont12)
        self.lbl000.pack(padx=5, pady=5)

        frame00a = Frame(self)
        frame00a.pack()
        self.lbl00a = Label(frame000, text=" ")
        self.lbl00a.pack(padx=5, pady=5)
Пример #30
0
 def initUI(self):
   
     self.parent.title("Review")
     self.pack(fill=BOTH, expand=True)
     
     frame1 = Frame(self)
     frame1.pack(fill=X)
     
     lbl1 = Label(frame1, text="Title", width=6)
     lbl1.pack(side=LEFT, padx=5, pady=5)           
    
     entry1 = Entry(frame1)
     entry1.pack(fill=X, padx=5, expand=True)
Пример #31
0
    def initUI(self):

        self.parent.title("Review")
        self.pack(fill=BOTH, expand=True)

        frame1 = Frame(self)
        frame1.pack(fill=X)

        lbl1 = Label(frame1, text="Title", width=6)
        lbl1.pack(side=LEFT, padx=5, pady=5)

        entry1 = Entry(frame1)
        entry1.pack(fill=X, padx=5, expand=True)
 def initUI(
     self
 ):  # in this part we create gui elements such as label button entry combobox etc.
     var1 = StringVar()
     var2 = StringVar()
     self.label = Label(self,
                        text="Attendance Keeper v1.0",
                        font='Helvetica 20 bold')
     self.label2 = Label(self,
                         text="Select student list Excel file:",
                         font='Helvetica 14 bold')
     self.button1 = Button(self,
                           text="Import List",
                           width=50,
                           command=self.import_files)
     self.label3 = Label(self,
                         text="Select a Student:",
                         font='Helvetica 14 bold')
     self.label4 = Label(self, text="Section:", font='Helvetica 14 bold')
     self.label5 = Label(self,
                         text="Attended Students:",
                         font='Helvetica 14 bold')
     self.listbox1 = Listbox(self, width=30, selectmode='multiple')
     self.combobox1 = ttk.Combobox(self, width=20, textvariable=var1)
     self.listbox2 = Listbox(self, width=40, selectmode='multiple')
     self.button2 = Button(self,
                           text="Add ->",
                           width=10,
                           command=self.add_items)
     self.button3 = Button(self,
                           text="<- Remove",
                           width=10,
                           command=self.remove_items)
     self.label6 = Label(self,
                         text="Please select file type:",
                         font='Helvetica 14 bold')
     self.combobox2 = ttk.Combobox(self, width=5, textvariable=var2)
     self.label7 = Label(self,
                         text="Please enter week:",
                         font='Helvetica 14 bold')
     self.entry = Entry(self)
     self.button4 = Button(self,
                           text="Export as File",
                           command=self.export_file)
     self.scroolbar = Scrollbar(self, orient=VERTICAL)
     self.scroolbar1 = Scrollbar(self, orient=VERTICAL)
     self.scroolbar.config(command=self.listbox1.yview)
     self.scroolbar1.config(comman=self.listbox2.yview)
     self.listbox1.config(yscrollcommand=self.scroolbar.set)
     self.listbox2.config(yscrollcommand=self.scroolbar1.set)
Пример #33
0
class cp_config_win(Toplevel):
    def __init__(self, parent):
        Toplevel.__init__(self)

        img = ImageTk.PhotoImage(file=os.path.join(os.path.dirname(__file__),
                                                   'Icons/LMS8001_PLLSim.png'))
        self.tk.call('wm', 'iconphoto', self._w, img)

        self.resizable(0, 0)
        self.parent = parent
        self.initUI()
        center_Window(self)
        self.protocol("WM_DELETE_WINDOW", self.on_Quit)

    def on_OK(self):
        self.on_Apply()
        self.on_Quit()

    def on_Apply(self):
        self.parent.cp_fc.set(float(self.entry_fc.get()) * 1.0e3)
        self.parent.cp_slope.set(float(self.entry_slope.get()))
        self.parent.pll.cp = lms8001_cp(fc=float(self.parent.cp_fc.get()),
                                        slope=float(
                                            self.parent.cp_slope.get()))
        self.parent.def_cp()

    def on_Quit(self):
        self.parent.cp_config_win = None
        self.destroy()

    def initUI(self):
        self.title('CP Noise Parameters')
        self.columnconfigure(0, pad=1)
        self.columnconfigure(1, pad=1)
        self.columnconfigure(2, pad=1)
        self.rowconfigure(0, pad=10)
        self.rowconfigure(1, pad=1)
        self.rowconfigure(2, pad=6)

        label1 = Label(self, text='Corner Frequency [kHz]')
        self.entry_fc = Entry(self, width=8)
        self.entry_fc.insert(END, str(self.parent.cp_fc.get() / 1.0e3))
        label1.grid(row=0, column=0, sticky=W)
        self.entry_fc.grid(row=0, column=1, sticky=W)

        label2 = Label(self, text='Noise slope [dB/dec]')
        self.entry_slope = Entry(self, width=8)
        self.entry_slope.insert(END, str(self.parent.cp_slope.get()))
        label2.grid(row=1, column=0, sticky=W)
        self.entry_slope.grid(row=1, column=1, sticky=W)

        button_OK = Button(self, text='OK', command=self.on_OK, width=10)
        button_Apply = Button(self,
                              text='Apply',
                              command=self.on_Apply,
                              width=10)
        button_Quit = Button(self, text='Quit', command=self.on_Quit, width=10)
        button_OK.grid(row=2, column=0, sticky=W + E + S)
        button_Apply.grid(row=2, column=1, sticky=W + E + S)
        button_Quit.grid(row=2, column=2, sticky=W + E + S)
Пример #34
0
    def body(self, master):

        Label(master, text="Label:").grid(row=0, sticky=W)
        Label(master, text="Theta (deg):").grid(row=1, sticky=W)

        self._label_var = StringVar(master, value=NodeInfoDialog._label_var)
        self._theta_var = StringVar(master, value=NodeInfoDialog._theta_var)

        self.e1 = Entry(master, textvariable=self._label_var)
        self.e2 = Entry(master, textvariable=self._theta_var)

        self.e1.grid(row=0, column=1)
        self.e2.grid(row=1, column=1)
        return self.e1  # initial focus
Пример #35
0
    def initUI(self):

        self.parent.title("Review")
        self.pack(fill=BOTH, expand=True)

        frame1 = Frame(self)
        frame1.pack(fill=X)

        lbl1 = Label(frame1, text="Title", width=6)
        lbl1.pack(side=LEFT, padx=5, pady=5)

        entry1 = Entry(frame1)
        entry1.pack(fill=X, padx=5, expand=True)

        frame2 = Frame(self)
        frame2.pack(fill=X)

        lbl2 = Label(frame2, text="Author", width=6)
        lbl2.pack(side=LEFT, padx=5, pady=5)

        entry2 = Entry(frame2)
        entry2.pack(fill=X, padx=5, expand=True)

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

        lbl3 = Label(frame3, text="Review", width=6)
        lbl3.pack(side=LEFT, anchor=N, padx=5, pady=5)

        txt = Text(frame3)
        txt.pack(fill=BOTH, pady=5, padx=5, expand=True)
Пример #36
0
    def initUI(self):
      
        self.parent.title("TRAM")
        self.style = Style()
        self.style.theme_use("default")

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

        #Model Text
        self.t = Text(self, borderwidth=3, relief="sunken")
        self.t.config(font=("consolas", 12), undo=True, wrap='word')
        self.t.grid(row=0, column=0, padx=2, pady=2, sticky=(N, W, E, S))
        
        
        
        #Search Panel
        searchPanel = LabelFrame(self, text="Find your model")
        searchPanel.grid(row=0, column=1, padx=2, pady=2, sticky=N) 
        
        Label(searchPanel, text="Model name").grid(row=0, column=0, padx=2, pady=2, sticky=W)
        
        searchQueryEntry = Entry(searchPanel, textvariable=self.searchQuery)
        searchQueryEntry.grid(row=0, column=1, padx=2, pady=2, sticky=W)
        
        Label(searchPanel, text="Transformation").grid(row=1, column=0, padx=2, pady=2, sticky=W)
        preferredTransformation = StringVar()
        box = Combobox(searchPanel, textvariable=preferredTransformation, state='readonly')
        box['values'] = ('Any...', 'Object Change', 'Object Extension', 'Specialization', 'Functionality Extension', 'System Extension', 'Soft Simplification', 'Hard Simplification')
        box.current(0)
        box.grid(row=1, column=1, padx=2, pady=2, sticky=W)
        
        findButton = Button(searchPanel, text="Find", command = self.__findModels)
        findButton.grid(row=2, column=1, padx=2, pady=2, sticky=E)
        
        #Listbox with recommendations
        recommendationPanel = LabelFrame(self, text="Recommended models (transformations)")
        recommendationPanel.grid(row=0, column=1, padx=2, pady=2, sticky=(W,E,S))
        self.l = Listbox(recommendationPanel)
        self.l.pack(fill=BOTH, expand=1)
        
        #Button frame
        transformButtonPanel = Frame(recommendationPanel)
        transformButtonPanel.pack(fill=BOTH, expand=1)
        
        viewButton = Button(transformButtonPanel, text="View", command = self.__loadSelectedModel)
        viewButton.grid(row=1, column=0, padx=2, pady=2)
        
        transformButton = Button(transformButtonPanel, text="Transform", command = self.__transformModel)
        transformButton.grid(row=1, column=2, padx=2, pady=2)
Пример #37
0
	def initUI(self, parameterDict, callback, validate, undoCallback):

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

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

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

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

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

		self.parent.bind("<Return>", buttonCallback)
		self.parent.bind("<KP_Enter>", buttonCallback)
		run = Button(self, text="Run fit", command=buttonCallback)
		run.grid(row=count, column=0)
		count = count + 1
		self.pack()
Пример #38
0
	def setupInputs(self):
		self.chooseDir = Button(self, text="Choose",command=self.getDir)
		self.chooseDir.place(x=10, y=10)
		self.selpath = Label(self, text=self.dir, font=("Helvetica", 12))
		self.selpath.place(x=150, y=10)

		self.aLabel = Label(self, text="Alpha", font=("Helvetica", 12))
		self.aLabel.place(x=10, y=50)
		self.aEntry = Entry()
		self.aEntry.place(x=200,y=50,width=400,height=30)

		self.bLabel = Label(self, text="Beta", font=("Helvetica", 12))
		self.bLabel.place(x=10, y=100)
		self.bEntry = Entry()
		self.bEntry.place(x=200,y=100,width=400,height=30)
Пример #39
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)
Пример #40
0
def buildValueWidget(frame, optType):
    if optType == "FOO":
        pass
    else:
        var = StringVar()
        widget = Entry(frame, textvariable=var)
        return widget, var
Пример #41
0
    def __init__(self, master, customers, payments, refresh):
        Toplevel.__init__(self,master)

        self.root = master
        self.refresh = refresh

        self.title("Check In")
        self.iconname = "Check In"

        self.name = StringVar() # variable for customer
        self.customers = customers # customers object
        self.payments = payments
        self.names = []
        self.workout = StringVar()
        self.workouts = []
        self.workouts_form = []
        self.date = StringVar()
        self.date.set(strftime("%m/%d/%Y"))
        self.refresh_time = 15 # in minutes
        self.output = '' # for the output label at the bottom
        self.schedule = Schedule()

        self.logger = Logger() #throws IOError if file is open

        inf = Frame(self)
        inf.pack(padx=10,pady=10,side='top')
        Label(inf, text="Name:").grid(row=0,column=0,sticky=E,ipady=2,pady=2,padx=10)
        Label(inf, text='Date:').grid(row=1,column=0,sticky=E,ipady=2,pady=2,padx=10)
        Label(inf, text="Workout:").grid(row=2,column=0,sticky=E,ipady=2,pady=2,padx=10)

        self.name_cb = Combobox(inf, textvariable=self.name, width=30,
                                values=self.names)
        self.name_cb.grid(row=0,column=1,sticky=W,columnspan=2)
        self.date_ent = Entry(inf, textvariable=self.date)
        self.date_ent.grid(row=1,column=1,sticky=W)
        self.date_ent.bind('<FocusOut>', self.update_workouts)
        Button(inf,text='Edit', command=self.enable_date_ent).grid(row=1,column=2,sticky=E)
        self.workout_cb = Combobox(inf, textvariable=self.workout, width=30,
                                   values=self.workouts_form,state='readonly')
        self.workout_cb.grid(row=2,column=1,sticky=W,columnspan=2)

        self.log_btn=Button(inf,text="Log Workout",command=self.log,width=12)
        self.log_btn.grid(row=3,column=1,columnspan=2,pady=4,sticky='ew')
        
        stf = Frame(self)
        stf.pack(padx=10,pady=10,fill='x',side='top')
        self.scrolled_text = ScrolledText(stf,height=15,width=50,wrap='word',state='disabled')
        self.scrolled_text.pack(expand=True,fill='both')

        self.update_workouts()
        self.update_names()

        self.bind('<Return>',self.log)
        self.name_cb.focus_set()  # set the focus here when created

        #disable the date field
        self.disable_date_ent()

        #start time caller
        self.time_caller()
Пример #42
0
    def extractText(self):
        # create child window
        win = Toplevel()
        # display message
        message = "Assembly Dump for .text section"
        Label(win, text=message).pack()
        self.scrollbar = Scrollbar(win)
        self.scrollbar.pack(side=RIGHT, fill=Y)
        self.T = Text(win, height=20, width=100)
        self.T.pack()
        self.scrollbar.config(command=self.T.yview)
        
        #Fill out the window with the data.
        with open("xeddumpbinary.txt") as input_data:
            for line in input_data:
                if line.strip() == '# IA32 format':
                    break
                #Reads text until the end of the block.
            for line in input_data: #keep reading
                if line.strip() == '# end of text section.':
                    break
                self.T.insert(END, line)
        message2 = "Search:"
        Label(win,text=message2).pack()
        self.es = Entry(win)
        self.es.pack()
        self.es.focus_set()

        Button(win, text='OK', command=self.searchTerm).pack()
Пример #43
0
    def __init__(self, place_class, string_class, DefaultValue, choise_class = False, button_add = False):
#При создании принимается место прикрепления виджета и строковое значение для надписи.
# A string value to add a combobox or a button could be also inputed.

        def button_finfo():
            messagebox.showinfo(locale(u"ui_iftxt", Settingz["str_langu"]), button_add)
# Here it is a function to show information window.

        self.frame_class = Frame(place_class)
        self.frame_class.pack(side = TOP, fill = BOTH)
#Внутри – рамка для виджетов, растягивается по ширине окна.
        self.label_class = Label(self.frame_class, text = string_class)
        self.label_class.pack(side = LEFT)
#В ней – надписи для описания вводимых значений выровнены по левому краю.
        self.entry_class = Entry(self.frame_class, width = 15)
        self.entry_class.pack(side = RIGHT)
        self.entry_class.insert(0, DefaultValue)
#И элементы для ввода значений шириной в 15 знаков выровнены по правому краю.
        if choise_class:
            self.box_class = Combobox(self.frame_class, values = choise_class, width = 2)
            self.box_class.set(choise_class[0])
            self.box_class.pack(side = RIGHT)
        elif button_add:
            self.button_class = Button(self.frame_class, text = u"?", command = button_finfo, width = -1)
            self.button_class.pack(side = RIGHT)
Пример #44
0
    def __init__(self, parent, controller):
        Frame.__init__(self, parent)
        self.controller = controller
        ChooseType.socket = None
        ChooseType.create_player = None
        
        self.plx_name = "PLAYER"
        ChooseType.plx_type = "SPECTATOR"
        ChooseType.start_game = None
        label_1 = Label(self, text="Create character", font=TITLE_FONT, justify=CENTER, anchor=CENTER)
        label_2 = Label(self, text="Name: ")
        self.entry_1 = Entry(self)
        self.entry_1.insert(0, 'Player_')

        label_3 = Label(self, text="Join as: ")
        button1 = Button(self, text="FROG", command=self.callback_frog)
        button2 = Button(self, text="FLY", command=self.callback_fly)
        button3 = Button(self, text="SPECTATOR", command=self.callback_spec)
        ChooseType.button4 = Button(self, text="Back", command=lambda: controller.show_frame("StartPage"))

        label_1.pack(side="top", fill="x", pady=10)
        label_2.pack()       
        self.entry_1.pack()
        label_3.pack()
        button1.pack()
        button2.pack()
        button3.pack()
        ChooseType.button4.pack(pady=20)
Пример #45
0
    def nuevoPais(self):
        t = Toplevel(self)
        t.wm_title("Pais")

        Label(t, text="Nombre").grid(row=0, column=1)
        E2 = Entry(t)
        E2.grid(row=1, column=1)

        button1 = Button(t, text="Cancelar", command=lambda: t.destroy())
        button2 = Button(t, text="Guardar", command=lambda: self.nuevaEntradaPais(E2.get(), t))
        button3 = Button(t, text="Borrar", command=lambda: self.BorrarPais(E2.get(), t))
        button3.config(state="disabled")

        button1.grid(row=2, column=0)
        button2.grid(row=2, column=1)
        button3.grid(row=2, column=2)
Пример #46
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)
Пример #47
0
class NodeInfoDialog(tkSimpleDialog.Dialog):

    _label_var = None
    _theta_var = None

    def body(self, master):

        Label(master, text="Label:").grid(row=0, sticky=W)
        Label(master, text="Theta (deg):").grid(row=1, sticky=W)

        self._label_var = StringVar(master, value=NodeInfoDialog._label_var)
        self._theta_var = StringVar(master, value=NodeInfoDialog._theta_var)

        self.e1 = Entry(master, textvariable=self._label_var)
        self.e2 = Entry(master, textvariable=self._theta_var)

        self.e1.grid(row=0, column=1)
        self.e2.grid(row=1, column=1)
        return self.e1  # initial focus

    def validate(self):
        if not self.e2.get() == "":
            theta = float(self.e2.get())
            if theta < -360.0 or theta > 360.0:
                tkMessageBox.showerror(
                    "Invalid Theta value",
                    "Insert a value between -360° and 360°")
                self.e2.delete(0, 'end')
                return 0
            else:
                return 1
        else:
            return 1

    def apply(self):
        label = self.e1.get()
        theta = self.e2.get()

        self.result = label, theta

    @staticmethod
    def setLabelField(label):
        NodeInfoDialog._label_var = str(label)

    @staticmethod
    def setThetaField(theta):
        NodeInfoDialog._theta_var = str(theta)
Пример #48
0
 def general_component(self, s, r, c, init_val='', help_txt=''):
     '''adds a label, plus an entry and its associated variable'''
     Label(self, text=s).grid(row=r, column=c, sticky=W)
     var = StringVar()
     var.set(init_val)
     Entry(self, textvariable=var).grid(row=r, column=c + 1)
     Label(self, text=help_txt).grid(row=r, column=c + 2)
     return var
Пример #49
0
    def initUI(self):
        self.parent.title("Carnets d adresses")
        
        Style().configure("TButton", padding=(0, 5, 0, 5), 
            font='serif 10')
            
        nbcolumn=range(4)
        pad_column=3
        self.create_column(nbcolumn,pad_column)
#        self.columnconfigure(0, pad=3)
#        self.columnconfigure(1, pad=3)
#        self.columnconfigure(2, pad=3)
#        self.columnconfigure(3, pad=3)
        
        self.rowconfigure(0, pad=3)
        self.rowconfigure(1, pad=3)
        self.rowconfigure(2, pad=3)
        self.rowconfigure(3, pad=3)
        self.rowconfigure(4, pad=3)
        self.rowconfigure(5, pad=3)
        self.rowconfigure(6, pad=3)
        
        self.ca_txt=Listbox(self)
        self.ca_txt.grid(row=0,column=0,rowspan=7, columnspan=2, sticky=N+S)

        self.label_nom = Label(self, text="Nom")
        self.label_nom.grid(row=0,column=2,sticky=W)
        self.label_prenom = Label(self, text="Prenom")
        self.label_prenom.grid(row=2,column=2,sticky=W)
        self.label_num = Label(self, text="Telephone")
        self.label_num.grid(row=4,column=2,sticky=W)
        
        
                
        self.nom = Entry(self)
        self.nom.grid(row=1,column=2, columnspan=2, sticky=E)
        self.prenom = Entry(self)
        self.prenom.grid(row=3,column=2, columnspan=2, sticky=E)
        self.num_tel = Entry(self)
        self.num_tel.grid(row=5,column=2, columnspan=2, sticky=E)

        self.save = Button(self, text="Save")
        self.save.grid(row=6, column=2)
        self.delete = Button(self, text="Delete")
        self.delete.grid(row=6, column=3)
        self.pack()
Пример #50
0
 def initUI(self):
   
     self.parent.title("Sequence modification parser")          
     
     self.columnconfigure(0, pad=5)
     self.columnconfigure(1, pad=5, weight = 1)
     self.columnconfigure(2, pad=5)
     
     self.rowconfigure(0, pad=5, weight = 1)
     self.rowconfigure(1, pad=5, weight = 1)
     self.rowconfigure(2, pad=5, weight = 1)
     self.rowconfigure(3, pad=5, weight = 1)
     self.rowconfigure(4, pad=5, weight = 1)
     self.rowconfigure(5, pad=5, weight = 1)
     
     self.lInput = Label(self, text = "Input file")
     self.lInput.grid(row = 0, column = 0, sticky = W)
     self.lPRS = Label(self, text = "phospoRS Column Name")
     self.lPRS.grid(row = 1, column = 0, sticky = W)
     self.lScore = Label(self, text = "Min phosphoRS Score")
     self.lScore.grid(row = 2, column = 0, sticky = W)
     self.lDA = Label(self, text = "Check deamidation sites")
     self.lDA.grid(row = 3, column = 0, sticky = W)
     self.lLabFile = Label(self, text = "Label description file")
     self.lLabFile.grid(row = 4, column = 0, sticky = W)
     
     self.ifPathText = StringVar()
     self.prsScoreText = StringVar(value = '0')
     self.prsNameText = StringVar()
     self.doDAVar = IntVar()
     self.labFileText = StringVar(value = path.abspath('moddict.txt'))
     
     self.ifPath = Entry(self, textvariable = self.ifPathText)
     self.ifPath.grid(row = 0, column = 1, sticky = W+E)
     self.prsName = Entry(self, textvariable = self.prsNameText)
     self.prsName.grid(row = 1, column = 1, sticky = W+E)        
     self.prsScore = Entry(self, textvariable = self.prsScoreText, state = DISABLED)
     self.prsScore.grid(row = 2, column = 1, sticky = W+E)
     self.doDABox = Checkbutton(self, variable = self.doDAVar)
     self.doDABox.grid(row = 3, column = 1, sticky = W)
     self.labFile = Entry(self, textvariable = self.labFileText)
     self.labFile.grid(row = 4, column = 1, sticky = W+E)
     
     
     self.foButton = Button(self, text = "Select file", command = self.selectFileOpen)
     self.foButton.grid(row = 0, column = 2, sticky = E+W, padx = 3)
     self.prsButton = Button(self, text = "Select column", state = DISABLED, command = self.selectColumn)
     self.prsButton.grid(row = 1, column = 2, sticky = E+W, padx = 3)
     self.labFileButton = Button(self, text = "Select file", command = self.selectLabFileOpen)
     self.labFileButton.grid(row = 4, column = 2, sticky = E+W, padx = 3)
     self.startButton = Button(self, text = "Start", command = self.start, padx = 3, pady = 3)
     self.startButton.grid(row = 5, column = 1, sticky = E+W)
     
 
     self.pack(fill = BOTH, expand = True, padx = 5, pady = 5)
Пример #51
0
    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)
Пример #52
0
 def createWidgets(self):
     self.mainFrame = Frame(self.parent)
     Label(self.mainFrame, text = 'Tic Tac Toe', font = ("", 50)).pack()
     frame1 = Frame(self.mainFrame)
     Label(frame1, text = 'Player 1 (X, button - 1)').grid()
     Entry(frame1, textvariable = self.player1)
     Label(frame1, text = 'Player2 (O, button - 2)').grid()
     frame1.pack()
     self.mainFrame.pack(padx = 10, pady = 10)
Пример #53
0
    def initUI(self):
        self.parent.title("Driver Control Panel")
        self.style = Style()
        self.style.theme_use("default")
        self.pack(fill=BOTH, expand=1)

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

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

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

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

        self.e = Entry(self, font=('Helvetica', '18'))
        self.e.grid(row=4, column=0)
        self.search = Button(self, text="Start")
        self.search.grid(row=6, column=0)

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

        self.turnOnBtn = Button(self, text="Turn On")
        self.turnOnBtn["command"] = self.turnOn
        self.turnOnBtn.grid(row=6, column=0)

        self.startBtn = Button(self, text="Start")
        self.startBtn["command"] = self.start
        self.startBtn.grid(row=7, column=0)

        self.turnOffBtn = Button(self, text="Turn Off")
        self.turnOffBtn["command"] = self.turnOff
        self.turnOffBtn.grid(row=8, column=0)
Пример #54
0
    def initUI(self):
        self.parent.title("Driver Control Panel")
        self.style = Style()
        self.style.theme_use("default")
        self.pack(fill=BOTH, expand=1)

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

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

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

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

        self.e = Entry(self, font=('Helvetica', '18'))
        self.e.grid(row=4, column=0)
        self.search = Button(self, text="Start")
        self.search.grid(row=6, column=0)   
        
        
        ######### used for debug ##########
        # add vertical space
        self.l2 = Label(self, text="", font=('Helvetica', '14'))
        self.l2.grid(row=5, column=0)
        
        self.turnOnBtn = Button(self, text="Turn On")
        self.turnOnBtn["command"] = self.turnOn 
        self.turnOnBtn.grid(row=6, column=0)    
        
        self.startBtn = Button(self, text="Start")
        self.startBtn["command"] = self.start 
        self.startBtn.grid(row=7, column=0)    
        
        self.turnOffBtn = Button(self, text="Turn Off")
        self.turnOffBtn["command"] = self.turnOff 
        self.turnOffBtn.grid(row=8, column=0)   
Пример #55
0
def init_ui(root):
    root.geometry("500x500+500+500")

    f = Frame(root)
    f.pack(fill=BOTH, expand=True)

    frame1 = Frame(f)
    frame1.pack(fill=X)

    lbl1 = Label(frame1, text="Enter url here", width=6)
    lbl1.pack(side=LEFT, padx=5, pady=5)

    entry1 = Entry(frame1)
    entry1.pack(fill=X, padx=5, expand=True)

    frame3 = Frame(f)
    frame3.pack(fill=X)

    lbl3 = Label(frame3, text="Keywords", width=6)
    lbl3.pack(side=LEFT, anchor=N, padx=5, pady=5)

    txt = Text(frame3)
    txt.pack(fill=BOTH, pady=5, padx=5, expand=True)

    def on_click():
        url = entry1.get()
        print url

        keywords = get_keywords(url)
        res = ", ".join(keywords)
        print res

        txt.delete("1.0", END)
        txt.insert("1.0", res)

    def on_click2():
        entry1.delete(0, END)

    frame2 = Frame(f)
    frame2.pack(fill=X)

    tk.Button(frame2, text="Get keywords", command=on_click).pack()
    tk.Button(frame2, text="Clear", command=on_click2).pack()
Пример #56
0
class DirectorySelector():
    def __init__(self, parent=None, text='Directory:', get_default=None):
        # NOTE: This class used to be a subclass of Frame, but it did not grid properly in the main window
        #Frame.__init__(self, parent)
        self.parent = parent
        self.label = Label(parent, text=text)
        self.directory = StringVar()
        on_change_cmd = parent.register(self.on_change)
        self.dir_entry = Entry(parent, textvariable=self.directory, validatecommand=on_change_cmd, validate='all')
        self.browse_btn = BrowseDirectoryButton(parent, entry=self)
        self.get_default = get_default
        self.notify_other = None

    def set_notify(self, notify_other):
        self.notify_other = notify_other

    def set_grid(self, row=0, padx=0):
        #self.grid(row=row)
        self.label.grid(row=row, column=0, sticky='e')
        self.dir_entry.grid(row=row, column=1, padx=padx, sticky='w')
        self.browse_btn.grid(row=row, column=2)

    def set_directory(self, directory):
        self.directory.set(directory)
        if self.notify_other != None:
            self.notify_other()
        #if self.parent != None:
            #self.parent.on_focus()

    def get_directory(self):
        directory = str(self.directory.get())
        if len(directory) > 0 and directory[len(directory)-1] != '/':
            directory = directory + '/'
        return directory

    def on_change(self):
        if self.get_default != None and self.get_directory() == '':
            self.set_directory(self.get_default())
        return True

    def notify(self):
        self.on_change()
Пример #57
0
 def __init__(self, parent=None, text='Directory:', get_default=None):
     # NOTE: This class used to be a subclass of Frame, but it did not grid properly in the main window
     #Frame.__init__(self, parent)
     self.parent = parent
     self.label = Label(parent, text=text)
     self.directory = StringVar()
     on_change_cmd = parent.register(self.on_change)
     self.dir_entry = Entry(parent, textvariable=self.directory, validatecommand=on_change_cmd, validate='all')
     self.browse_btn = BrowseDirectoryButton(parent, entry=self)
     self.get_default = get_default
     self.notify_other = None
Пример #58
0
 def initUI(self):
   
     self.parent.title("Review")
     self.pack(fill=BOTH, expand=True)
     labelfont20 = ('Roboto', 20, 'bold')
     labelfont12 = ('Roboto', 12, 'bold')
     
     frame0 = Frame(self)
     frame0.pack()
     
     lbl0 = Label(frame0, text="Hi USER")
     lbl0.config(font=labelfont20)    
     lbl0.pack( padx=5, pady=5)
     lbl00 = Label(frame0, text="Search here")
     lbl00.config(font=labelfont12)
     lbl00.pack( padx=5, pady=5)
     
     
     frame1 = Frame(self)
     frame1.pack()
     
     lbl1 = Label(frame1, text="min %", width=9)
     lbl1.pack(side=LEFT, padx=7, pady=5)           
    
     self.entry1 = Entry(frame1,width=20)
     self.entry1.pack(padx=5, expand=True)
     
     
     
     
     
     frame6 = Frame(self)
     frame6.pack()
     closeButton = Button(frame6, text="Get Names",width=12,command=self.getDate)
     closeButton.pack(padx=5, pady=5)
     
     frame7 = Frame(self)
     frame7.pack()
     closeButton1 = Button(frame7, text="Open in excel",width=15,command=self.openDate)
     closeButton1.pack(padx=5, pady=5)
     
     
     
     frame000 = Frame(self)
     frame000.pack()
     self.lbl000= Label(frame000, text=" ")
     self.lbl000.config(font=labelfont12)    
     self.lbl000.pack( padx=5, pady=5)
     
     frame00a = Frame(self)
     frame00a.pack()
     self.lbl00a= Label(frame000, text=" ")
     self.lbl00a.pack( padx=5, pady=5)