Python Tkinter.Entry() Examples

The following are 30 code examples of Tkinter.Entry(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module Tkinter , or try the search function .
Example #1
Source File: annotation_gui.py    From SEM with MIT License 9 votes vote down vote up
def preferences(self, event=None):
        preferenceTop = tkinter.Toplevel()
        preferenceTop.focus_set()
        
        notebook = ttk.Notebook(preferenceTop)
        
        frame1 = ttk.Frame(notebook)
        notebook.add(frame1, text='general')
        frame2 = ttk.Frame(notebook)
        notebook.add(frame2, text='shortcuts')

        c = ttk.Checkbutton(frame1, text="Match whole word when broadcasting annotation", variable=self._whole_word)
        c.pack()
        
        shortcuts_vars = []
        shortcuts_gui = []
        cur_row = 0
        j = -1
        frame_list = []
        frame_list.append(ttk.LabelFrame(frame2, text="common shortcuts"))
        frame_list[-1].pack(fill="both", expand="yes")
        for i, shortcut in enumerate(self.shortcuts):
            j += 1
            key, cmd, bindings = shortcut
            name, command = cmd
            shortcuts_vars.append(tkinter.StringVar(frame_list[-1], value=key))
            tkinter.Label(frame_list[-1], text=name).grid(row=cur_row, column=0, sticky=tkinter.W)
            entry = tkinter.Entry(frame_list[-1], textvariable=shortcuts_vars[j])
            entry.grid(row=cur_row, column=1)
            cur_row += 1
        notebook.pack()
    
    #
    # ? menu methods
    # 
Example #2
Source File: viewer.py    From networkx_viewer with GNU General Public License v3.0 7 votes vote down vote up
def __init__(self, main_window, msg='Please enter a node:'):
        tk.Toplevel.__init__(self)
        self.main_window = main_window
        self.title('Node Entry')
        self.geometry('170x160')
        self.rowconfigure(3, weight=1)

        tk.Label(self, text=msg).grid(row=0, column=0, columnspan=2,
                                      sticky='NESW',padx=5,pady=5)
        self.posibilities = [d['dataG_id'] for n,d in
                    main_window.canvas.dispG.nodes_iter(data=True)]
        self.entry = AutocompleteEntry(self.posibilities, self)
        self.entry.bind('<Return>', lambda e: self.destroy(), add='+')
        self.entry.grid(row=1, column=0, columnspan=2, sticky='NESW',padx=5,pady=5)

        tk.Button(self, text='Ok', command=self.destroy).grid(
            row=3, column=0, sticky='ESW',padx=5,pady=5)
        tk.Button(self, text='Cancel', command=self.cancel).grid(
            row=3, column=1, sticky='ESW',padx=5,pady=5)

        # Make modal
        self.winfo_toplevel().wait_window(self) 
Example #3
Source File: ttk.py    From oss-ftp with MIT License 6 votes vote down vote up
def __init__(self, master=None, widget=None, **kw):
        """Constructs a Ttk Entry widget with the parent master.

        STANDARD OPTIONS

            class, cursor, style, takefocus, xscrollcommand

        WIDGET-SPECIFIC OPTIONS

            exportselection, invalidcommand, justify, show, state,
            textvariable, validate, validatecommand, width

        VALIDATION MODES

            none, key, focus, focusin, focusout, all
        """
        Widget.__init__(self, master, widget or "ttk::entry", kw) 
Example #4
Source File: ttk.py    From Splunking-Crime with GNU Affero General Public License v3.0 6 votes vote down vote up
def __init__(self, master=None, widget=None, **kw):
        """Constructs a Ttk Entry widget with the parent master.

        STANDARD OPTIONS

            class, cursor, style, takefocus, xscrollcommand

        WIDGET-SPECIFIC OPTIONS

            exportselection, invalidcommand, justify, show, state,
            textvariable, validate, validatecommand, width

        VALIDATION MODES

            none, key, focus, focusin, focusout, all
        """
        Widget.__init__(self, master, widget or "ttk::entry", kw) 
Example #5
Source File: ttk.py    From BinderFilter with MIT License 6 votes vote down vote up
def __init__(self, master=None, widget=None, **kw):
        """Constructs a Ttk Entry widget with the parent master.

        STANDARD OPTIONS

            class, cursor, style, takefocus, xscrollcommand

        WIDGET-SPECIFIC OPTIONS

            exportselection, invalidcommand, justify, show, state,
            textvariable, validate, validatecommand, width

        VALIDATION MODES

            none, key, focus, focusin, focusout, all
        """
        Widget.__init__(self, master, widget or "ttk::entry", kw) 
Example #6
Source File: btcrseed.py    From btcrecover with GNU General Public License v2.0 6 votes vote down vote up
def show_mnemonic_gui(mnemonic_sentence):
    """may be called *after* main() to display the successful result iff the GUI is in use

    :param mnemonic_sentence: the mnemonic sentence that was found
    :type mnemonic_sentence: unicode
    :rtype: None
    """
    assert tk_root
    global pause_at_exit
    padding = 6
    tk.Label(text="WARNING: seed information is sensitive, carefully protect it and do not share", fg="red") \
        .pack(padx=padding, pady=padding)
    tk.Label(text="Seed found:").pack(side=tk.LEFT, padx=padding, pady=padding)
    entry = tk.Entry(width=80, readonlybackground="white")
    entry.insert(0, mnemonic_sentence)
    entry.config(state="readonly")
    entry.select_range(0, tk.END)
    entry.pack(side=tk.LEFT, fill=tk.X, expand=True, padx=padding, pady=padding)
    tk_root.deiconify()
    tk_root.lift()
    entry.focus_set()
    tk_root.mainloop()  # blocks until the user closes the window
    pause_at_exit = False 
Example #7
Source File: Frame_2D_GUI.py    From Structural-Engineering with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
def build_bm_gui_table(self,*event):

            for element in self.beam_gui_list:
                element.destroy()

            del self.beam_gui_list[:]

            for i,bm in enumerate(self.beam_inputs):

                a = tk.Entry(self.bm_info_tab,textvariable=bm[0], width=8, state=tk.DISABLED)
                a.grid(row=i+2,column=1, pady=4)
                b = tk.Entry(self.bm_info_tab,textvariable=bm[1], width=8)
                b.grid(row=i+2,column=2)
                c = tk.Entry(self.bm_info_tab,textvariable=bm[2], width=8)
                c.grid(row=i+2,column=3)
                d = tk.Entry(self.bm_info_tab,textvariable=bm[3], width=8)
                d.grid(row=i+2,column=4)

                self.beam_gui_list.extend([a,b,c,d]) 
Example #8
Source File: Frame_2D_GUI_metric.py    From Structural-Engineering with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
def build_bm_gui_table(self,*event):

            for element in self.beam_gui_list:
                element.destroy()

            del self.beam_gui_list[:]

            for i,bm in enumerate(self.beam_inputs):

                a = tk.Entry(self.bm_info_tab,textvariable=bm[0], width=8, state=tk.DISABLED)
                a.grid(row=i+2,column=1, pady=4)
                b = tk.Entry(self.bm_info_tab,textvariable=bm[1], width=8)
                b.grid(row=i+2,column=2)
                c = tk.Entry(self.bm_info_tab,textvariable=bm[2], width=8)
                c.grid(row=i+2,column=3)
                d = tk.Entry(self.bm_info_tab,textvariable=bm[3], width=8)
                d.grid(row=i+2,column=4)

                self.beam_gui_list.extend([a,b,c,d]) 
Example #9
Source File: guiClass.py    From Video-Downloader with GNU General Public License v2.0 5 votes vote down vote up
def __configPanel (self) :
		self.slave = Tkinter.Toplevel();

		self.slave.title("Config")
		self.slave.resizable(width = 'false', height = 'false')

		l1 = Tkinter.Label(self.slave, text = '下载目录:')
		l1.grid(row = 0)

		self.filePath = Tkinter.StringVar()
		self.filePath.set(self.cfg['path'])
		e1 = Tkinter.Entry(self.slave, textvariable = self.filePath)
		e1.grid(row = 0, column = 1, columnspan = 3)

		b1 = Tkinter.Button(self.slave, text = '选择', command = self.__chooseCfgFolder)
		b1.grid(row = 0, column = 4, sticky = 'e')

		l2 = Tkinter.Label(self.slave, text = '检查更新:')
		l2.grid(row = 1)

		self.chkUpdateTime = Tkinter.IntVar()
		self.chkUpdateTime.set(int(self.cfg['udrate']))
		r1 = Tkinter.Radiobutton(self.slave, text="每天", variable=self.chkUpdateTime, value=1)
		r1.grid(row = 1, column = 1, sticky = 'e')
		r2 = Tkinter.Radiobutton(self.slave, text="每周", variable=self.chkUpdateTime, value=2)
		r2.grid(row = 1, column = 2, sticky = 'e')
		r3 = Tkinter.Radiobutton(self.slave, text="每月", variable=self.chkUpdateTime, value=3)
		r3.grid(row = 1, column = 3, sticky = 'e')

		b2 = Tkinter.Button(self.slave, text = '更新', command = self.__setConfig)
		b2.grid(row = 2, column = 1, sticky = 'e')

		b3 = Tkinter.Button(self.slave, text = '取消', command = self.slave.destroy)
		b3.grid(row = 2, column = 2, sticky = 'e') 
Example #10
Source File: guiClass.py    From Video-Downloader with GNU General Public License v2.0 5 votes vote down vote up
def __topBox (self) :
		self.mainTop = Tkinter.Frame(self.master, bd = 10)
		self.mainTop.grid(row = 0, column = 0, sticky = '')		

		self.urlInput = Tkinter.Entry(self.mainTop, width = 50)
		self.urlInput.grid(row = 0, column = 0)

		s = self.__selector(self.mainTop)
		s.grid(row = 0, column = 1)

		self.__searchBtn() 
Example #11
Source File: Tkinter_Widget_Examples.py    From MacAdmins-2016-Craft-GUIs-with-Python-and-Tkinter with MIT License 5 votes vote down vote up
def __init__(self, master):
        tk.Frame.__init__(self, master)
        self.pack()

        tk.Label(self, text="This is a normal text entry box").pack()

        self.entry = tk.Entry(self, bg='white')
        self.entry.pack()

        tk.Label(self, text="This is a secret text entry box for passwords").pack()

        self.secret_entry = tk.Entry(self, show='*', bg='white')
        self.secret_entry.pack()

        tk.Button(self, text='OK', command=self.ok).pack() 
Example #12
Source File: pcwg_tool_reborn.py    From PCWG with MIT License 5 votes vote down vote up
def addEntry(self, master, title, validation, value, width = None):

            variable = tk.StringVar(master, value)

            label = tk.Label(master, text=title)
            label.grid(row = self.row, sticky=tk.W, column=self.labelColumn)

            tipLabel = tk.Label(master, text="")
            tipLabel.grid(row = self.row, sticky=tk.W, column=self.tipColumn)

            if validation != None:
                    validation.messageLabel.grid(row = self.row, sticky=tk.W, column=self.messageColumn)
                    validation.title = title
                    self.validations.append(validation)
                    validationCommand = validation.CMD
            else:
                    validationCommand = None

            entry = tk.Entry(master, textvariable=variable, validate = 'key', validatecommand = validationCommand, width = width)

            entry.grid(row=self.row, column=self.inputColumn, sticky=tk.W)

            if validation != None:
                validation.link(entry)

            self.row += 1

            return VariableEntry(variable, entry, tipLabel) 
Example #13
Source File: base_dialog.py    From PCWG with MIT License 5 votes vote down vote up
def addEntry(self, master, title, validation, value, width = None, read_only = False):

        variable = tk.StringVar(master, value)

        label = tk.Label(master, text=title)
        label.grid(row = self.row, sticky=tk.W, column=self.labelColumn)

        tipLabel = tk.Label(master, text="")
        tipLabel.grid(row = self.row, sticky=tk.W, column=self.tipColumn)

        if validation != None:
            validation.messageLabel.grid(row = self.row, sticky=tk.W, column=self.messageColumn)
            validation.title = title
            self.validations.append(validation)
            validationCommand = validation.CMD
        else:
            validationCommand = None

        entry = tk.Entry(master, textvariable=variable, validate = 'key', validatecommand = validationCommand, width = width)

        if read_only:
            entry.config(state=tk.DISABLED)

        entry.grid(row=self.row, column=self.inputColumn, sticky=tk.W)

        if validation != None:
            validation.link(entry)

        self.row += 1

        return VariableEntry(variable, entry, tipLabel) 
Example #14
Source File: test_widgets.py    From PokemonGo-DesktopMap with MIT License 5 votes vote down vote up
def create(self, **kwargs):
        return tkinter.Entry(self.root, **kwargs) 
Example #15
Source File: test_editmenu.py    From PokemonGo-DesktopMap with MIT License 5 votes vote down vote up
def setUpClass(cls):
        requires('gui')
        cls.root = root = tk.Tk()
        PyShell.fix_x11_paste(root)
        cls.text = tk.Text(root)
        cls.entry = tk.Entry(root)
        cls.spin = tk.Spinbox(root)
        root.clipboard_clear()
        root.clipboard_append('two') 
Example #16
Source File: menotexport-gui.py    From Menotexport with GNU General Public License v3.0 5 votes vote down vote up
def addPathFrame(self):
        frame=Frame(self)
        frame.pack(fill=tk.X,expand=0,side=tk.TOP,padx=8,pady=5)

        frame.columnconfigure(1,weight=1)

        #------------------Database file------------------
        label=tk.Label(frame,text='Mendeley Data file:',\
                bg='#bbb')
        label.grid(row=0,column=0,\
                sticky=tk.W,padx=8)

        self.db_entry=tk.Entry(frame)
        self.db_entry.grid(row=0,column=1,sticky=tk.W+tk.E,padx=8)

        self.db_button=tk.Button(frame,text='Open',command=self.openFile)
        self.db_button.grid(row=0,column=2,padx=8,sticky=tk.E)

        hint='''
Default location on Linux:
~/.local/share/data/Mendeley\ Ltd./Mendeley\ Desktop/your_email@www.mendeley.com.sqlite
Default location on Windows:
C:\Users\Your_name\AppData\Local\Mendeley Ltd\Mendeley Desktop\your_email@www.mendeley.com.sqlite'''

        hint_label=tk.Label(frame,text=hint,\
                justify=tk.LEFT,anchor=tk.NW)
        hint_label.grid(row=1,column=0,columnspan=3,\
                sticky=tk.W,padx=8)

        #--------------------Output dir--------------------
        label2=tk.Label(frame,text='Output folder:',\
                bg='#bbb')
        label2.grid(row=2,column=0,\
                sticky=tk.W,padx=8)

        self.out_entry=tk.Entry(frame)
        self.out_entry.grid(row=2,column=1,sticky=tk.W+tk.E,padx=8)
        self.out_button=tk.Button(frame,text='Choose',command=self.openDir)
        self.out_button.grid(row=2,column=2,padx=8,sticky=tk.E) 
Example #17
Source File: SkyFit.py    From RMS with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, parent):

        self.parent = parent

        # Set initial angle values
        self.azim = self.alt = self.rot = 0

        self.top = tkinter.Toplevel(parent)

        # Bind the Enter key to run the verify function
        self.top.bind('<Return>', self.verify)

        tkinter.Label(self.top, text="FOV centre (degrees) \nAzim +E of due N\nRotation from vertical").grid(row=0, columnspan=2)

        azim_label = tkinter.Label(self.top, text='Azim = ')
        azim_label.grid(row=1, column=0)
        self.azimuth = tkinter.Entry(self.top)
        self.azimuth.grid(row=1, column=1)
        self.azimuth.focus_set()

        elev_label = tkinter.Label(self.top, text='Alt  =')
        elev_label.grid(row=2, column=0)
        self.altitude = tkinter.Entry(self.top)
        self.altitude.grid(row=2, column=1)

        rot_label = tkinter.Label(self.top, text='Rotation  =')
        rot_label.grid(row=3, column=0)
        self.rotation = tkinter.Entry(self.top)
        self.rotation.grid(row=3, column=1)
        self.rotation.insert(0, '0')

        b = tkinter.Button(self.top, text="OK", command=self.verify)
        b.grid(row=4, columnspan=2) 
Example #18
Source File: ThermostatSimulatorApp.py    From aws-iot-device-sdk-arduino-yun with Apache License 2.0 5 votes vote down vote up
def _packModule(self):
        self._tkRootHandler.title("ThermostatSimulatorApp")
        self._tkRootHandler.geometry("500x250")
        self._tkRootHandler.resizable(width=False, height=False)
        # Pack all frames
        baseFrame = tkinter.Frame(self._tkRootHandler)
        temperatureFrame = tkinter.Frame(baseFrame)
        temperatureFrame.pack(side="top")
        controlPanelFrame = tkinter.Frame(baseFrame)
        controlPanelFrame.pack(side="bottom")
        baseFrame.pack()
        # Pack all modules for temperature frame
        self._reportedDataVariable = tkinter.StringVar()
        self._reportedDataVariable.set("XX.X F")
        reportedDataTag = tkinter.Label(temperatureFrame, text="Reported Temperature:", justify="left")
        self._reportedDataDisplayBox = tkinter.Label(temperatureFrame, textvariable=self._reportedDataVariable, font=("Arial", 55), justify="left")
        #
        self._desiredDataVariable = tkinter.StringVar()
        self._desiredDataVariable.set("XX.X F")
        desiredDataTag = tkinter.Label(temperatureFrame, text="Desired Temperature:", justify="left")
        self._desiredDataDisplayBox = tkinter.Label(temperatureFrame, textvariable=self._desiredDataVariable, font=("Arial", 55), justify="left")
        #
        reportedDataTag.pack()
        self._reportedDataDisplayBox.pack()
        desiredDataTag.pack()
        self._desiredDataDisplayBox.pack()
        # Create a callback pool
        self._callbackPoolHandler = ThermoSimAppCallbackPool(self._tkRootHandler, self._reportedDataDisplayBox, self._thermostatSimulatorShadowHandler, self._reportedDataVariable, self._desiredDataVariable)
        # Pack all modules for control panel frame
        self._setTemperatureInputBox = tkinter.Entry(controlPanelFrame)
        self._setTemperatureInputBox.pack(sid="left")
        self._setTemperatureButton = tkinter.Button(controlPanelFrame, text="SET", command=lambda: self._callbackPoolHandler.buttonCallback(self._setTemperatureInputBox, self._desiredDataVariable))
        self._setTemperatureButton.pack() 
Example #19
Source File: record.py    From TensorKart with MIT License 5 votes vote down vote up
def create_main_panel(self):
        # Panels
        top_half = tk.Frame(self.root)
        top_half.pack(side=tk.TOP, expand=True, padx=5, pady=5)
        message = tk.Label(self.root, text="(Note: UI updates are disabled while recording)")
        message.pack(side=tk.TOP, padx=5)
        bottom_half = tk.Frame(self.root)
        bottom_half.pack(side=tk.LEFT, padx=5, pady=10)

        # Images
        self.img_panel = tk.Label(top_half, image=ImageTk.PhotoImage("RGB", size=IMAGE_SIZE)) # Placeholder
        self.img_panel.pack(side = tk.LEFT, expand=False, padx=5)

        # Joystick
        self.init_plot()
        self.PlotCanvas = FigCanvas(figure=self.fig, master=top_half)
        self.PlotCanvas.get_tk_widget().pack(side=tk.RIGHT, expand=False, padx=5)

        # Recording
        textframe = tk.Frame(bottom_half, width=332, height=15, padx=5)
        textframe.pack(side=tk.LEFT)
        textframe.pack_propagate(0)
        self.outputDirStrVar = tk.StringVar()
        self.txt_outputDir = tk.Entry(textframe, textvariable=self.outputDirStrVar, width=100)
        self.txt_outputDir.pack(side=tk.LEFT)
        self.outputDirStrVar.set("samples/" + datetime.now().strftime('%Y-%m-%d_%H:%M:%S'))

        self.record_button = ttk.Button(bottom_half, text="Record", command=self.on_btn_record)
        self.record_button.pack(side = tk.LEFT, padx=5) 
Example #20
Source File: ListPanel.py    From Python-Media-Player with Apache License 2.0 5 votes vote down vote up
def create_song_list_panel(self):
        # Creating Picture Canvas as Background
        background=Tkinter.PhotoImage(file="../Icons/background.gif")
        mainframe=Tkinter.Canvas(self.root)
        mainframe.pack(side='top', expand='yes', fill='both')
        mainframe.image=background
        mainframe.create_image(0, 0, anchor="nw", image=background)
        
        frame0=Tkinter.Frame(mainframe)
        frame0.pack(side='top')
        Tkinter.Label(frame0, text='Search : ', bg='skyblue').pack(side='left', expand='yes', fill='x')
        Tkinter.Entry(frame0, textvariable=self.var1).pack(side='left', expand='yes', fill='x')
        frame0.bind_all('<Any-KeyPress>',self.search_song_trigger)
        frame=Tkinter.Frame(mainframe, bg='skyblue')
        frame.pack(side='top')
        self.list_box=Tkinter.Listbox(frame, bg='powderblue', font=list_box_song_list_font, width=list_box_width, height=list_box_height)
        scrollbar=Tkinter.Scrollbar(frame, bg='skyblue')
        scrollbar.pack(side='right',expand='yes',fill='y')
        scrollbar.config(command=self.list_box.yview)
        self.list_box.config(yscrollcommand=scrollbar.set)
        self.list_box.pack(expand='yes',fill='both',side='right')
        frame1=Tkinter.Frame(mainframe, bg='blue')
        frame1.pack(side='top', expand='yes',fill='x')
        add_fileicon=Tkinter.PhotoImage(file="../Icons/add_file.gif")
        add_directoryicon=Tkinter.PhotoImage(file="../Icons/add_directory.gif")
        list_file=[
        (add_fileicon,'self.ask_for_play_song_direct'),
        (add_directoryicon,'self.ask_for_directory'),
        ]
        for i,j in list_file:
                storeobj=Tkinter.Button(frame1, image=i, command=eval(j), bg='blue')
                storeobj.pack(side='left')
                storeobj.image=i
        self.list_box.bind('<Double-Button-1>',self.play_on_click)
        return self.update_list_box_songs() 
Example #21
Source File: plistwindow.py    From ProperTree with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def __init__(self, parent, master, text, cell, column, **kw):
        tk.Entry.__init__(self, parent, **kw)

        self.insert(0, text)
        self.select_all() 
        self['state'] = 'normal'
        self['readonlybackground'] = 'white'
        self['selectbackground'] = '#1BA1E2'
        self['exportselection'] = True

        self.cell = cell
        self.column = column
        self.parent = parent
        self.master = master

        self.focus_force()
        
        if str(sys.platform) == "darwin":
            self.bind("<Command-a>", self.select_all)
            self.bind("<Command-c>", self.copy)
            self.bind("<Command-v>", self.paste)
        else:
            self.bind("<Control-a>", self.select_all)
            self.bind("<Control-c>", self.copy)
            self.bind("<Control-v>", self.paste)
        self.bind("<Escape>", self.cancel)
        self.bind("<Return>", self.confirm)
        self.bind("<KP_Enter>", self.confirm)
        self.bind("<Up>", self.goto_start)
        self.bind("<Down>", self.goto_end)
        self.bind("<Tab>", self.next_field) 
Example #22
Source File: 05_Password_Prompt.py    From MacAdmins-2016-Craft-GUIs-with-Python-and-Tkinter with MIT License 5 votes vote down vote up
def __init__(self, master):
        tk.Frame.__init__(self, master)
        self.pack()
        self.master.title("")
        self.master.resizable(False, False)
        self.master.tk_setPalette(background='#ececec')

        self.master.protocol('WM_DELETE_WINDOW', self.click_cancel)
        self.master.bind('<Return>', self.click_ok)
        self.master.bind('<Escape>', self.click_cancel)

        x = (self.master.winfo_screenwidth() - self.master.winfo_reqwidth()) / 2
        y = (self.master.winfo_screenheight() - self.master.winfo_reqheight()) / 3
        self.master.geometry("+{}+{}".format(x, y))

        self.master.config(menu=tk.Menu(self))

        tk.Message(self, text="Please authenticate with your username and password before continuing.",
                   font='System 14 bold', justify='left', aspect=800).pack(pady=(15, 0))

        dialog_frame = tk.Frame(self)
        dialog_frame.pack(padx=20, pady=15, anchor='w')

        tk.Label(dialog_frame, text='Username:').grid(row=0, column=0, sticky='w')

        self.user_input = tk.Entry(dialog_frame, background='white', width=24)
        self.user_input.grid(row=0, column=1, sticky='w')
        self.user_input.focus_set()

        tk.Label(dialog_frame, text='Password:').grid(row=1, column=0, sticky='w')

        self.pass_input = tk.Entry(dialog_frame, background='white', width=24, show='*')
        self.pass_input.grid(row=1, column=1, sticky='w')

        button_frame = tk.Frame(self)
        button_frame.pack(padx=15, pady=(0, 15), anchor='e')

        tk.Button(button_frame, text='OK', height=1, width=6, default='active', command=self.click_ok).pack(side='right')

        tk.Button(button_frame, text='Cancel', height=1, width=6, command=self.click_cancel).pack(side='right', padx=10) 
Example #23
Source File: bolts_IC_gui.py    From Structural-Engineering with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def send_aisc_geometry(self,xloc,yloc, *events):
        if self.aisc_has_run == 0:
            pass
        
        else:
            self.hasrun=0
            for element in self.bolt_gui_elements:
                element.destroy()
            
            del self.bolt_gui_elements[:]
            del self.bolt_x_gui[:]
            del self.bolt_y_gui[:]
            
            self.bolt_count = len(xloc)
            
            for i in range(len(xloc)):
            
                self.bolt_x_gui.append(tk.StringVar())
                self.bolt_y_gui.append(tk.StringVar())
                
                x = xloc[i]
                y = yloc[i]
                
                self.bolt_x_gui[-1].set(x)
                self.bolt_y_gui[-1].set(y)
                
            for i in range(self.bolt_count):
                c = tk.Label(self.bolt_canvas_frame, text="Bolt {0}".format(i), font=self.helv)
                c.grid(row=i, column=0, sticky=tk.W)
                a = tk.Entry(self.bolt_canvas_frame, textvariable=self.bolt_x_gui[i], width=10)
                a.grid(row=i, column=1)
                b = tk.Entry(self.bolt_canvas_frame, textvariable=self.bolt_y_gui[i], width=10)
                b.grid(row=i, column=2)
                
                self.bolt_gui_elements.append(c)
                self.bolt_gui_elements.append(a)
                self.bolt_gui_elements.append(b)
                
            self.draw_bolts() 
Example #24
Source File: simple_beam_metric.py    From Structural-Engineering with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def build_loads_gui(self, *event):
        #Destroy all the individual tkinter gui elements for the current applied loads
        for load_gui in self.loads_gui:
            for gui_element in load_gui:
                gui_element.destroy()

        #Delete all the elements in the List containing the gui elements
        del self.loads_gui[:]
        del self.loads_scale[:]

        n = 0
        for loads in self.loads_gui_select_var:
            load_types = ['Point','Moment','UDL','TRAP']
            load_locals = ['Left','Center','Right']

            if loads[6].get() == 'Moment':
                self.loads_scale.append(float(loads[1].get())/2.0)
            else:
                self.loads_scale.append(float(loads[1].get()))
            self.loads_scale.append(float(loads[2].get()))

            self.loads_gui.append([
                tk.Checkbutton(self.loads_frame, variable=loads[0], command = self.build_loads),
                tk.Entry(self.loads_frame, textvariable=loads[1], width=15),
                tk.Entry(self.loads_frame, textvariable=loads[2], width=15),
                tk.Entry(self.loads_frame, textvariable=loads[3], width=15),
                tk.Entry(self.loads_frame, textvariable=loads[4], width=15),
                tk.OptionMenu(self.loads_frame, loads[5], *load_locals),
                tk.OptionMenu(self.loads_frame, loads[6], *load_types)])

            self.loads_gui[n][0].grid(row=n+1, column=1)
            self.loads_gui[n][1].grid(row=n+1, column=2, padx = 4)
            self.loads_gui[n][2].grid(row=n+1, column=3, padx = 4)
            self.loads_gui[n][3].grid(row=n+1, column=4, padx = 4)
            self.loads_gui[n][4].grid(row=n+1, column=5, padx = 4)
            self.loads_gui[n][5].grid(row=n+1, column=6)
            self.loads_gui[n][6].grid(row=n+1, column=7)
            n+=1 
Example #25
Source File: bolts_IC_gui.py    From Structural-Engineering with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def add_bolt(self, *event):
        self.hasrun=0
        self.bolt_count +=1
        
        for element in self.bolt_gui_elements:
            element.destroy()
            
        del self.bolt_gui_elements[:]
            
        self.bolt_x_gui.append(tk.StringVar())
        self.bolt_y_gui.append(tk.StringVar())
        
        x = self.bolt_x_in.get()
        y = self.bolt_y_in.get()
        
        self.bolt_x_gui[-1].set(x)
        self.bolt_y_gui[-1].set(y)
        
        for i in range(self.bolt_count):
            c = tk.Label(self.bolt_canvas_frame, text="Bolt {0}".format(i), font=self.helv)
            c.grid(row=i, column=0, sticky=tk.W)
            a = tk.Entry(self.bolt_canvas_frame, textvariable=self.bolt_x_gui[i], width=10)
            a.grid(row=i, column=1)
            b = tk.Entry(self.bolt_canvas_frame, textvariable=self.bolt_y_gui[i], width=10)
            b.grid(row=i, column=2)
            
            self.bolt_gui_elements.append(c)
            self.bolt_gui_elements.append(a)
            self.bolt_gui_elements.append(b)
            
        self.draw_bolts()
        self.onFrameConfigure() 
Example #26
Source File: simple_beam.py    From Structural-Engineering with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def build_loads_gui(self, *event):
        #Destroy all the individual tkinter gui elements for the current applied loads
        for load_gui in self.loads_gui:
            for gui_element in load_gui:
                gui_element.destroy()

        #Delete all the elements in the List containing the gui elements
        del self.loads_gui[:]
        del self.loads_scale[:]

        n = 0
        for loads in self.loads_gui_select_var:
            load_types = ['Point','Moment','UDL','TRAP']
            load_locals = ['Left','Center','Right']

            if loads[6].get() == 'Moment':
                self.loads_scale.append(float(loads[1].get())/2.0)
            else:
                self.loads_scale.append(float(loads[1].get()))
            self.loads_scale.append(float(loads[2].get()))

            self.loads_gui.append([
                tk.Checkbutton(self.loads_frame, variable=loads[0], command = self.build_loads),
                tk.Entry(self.loads_frame, textvariable=loads[1], width=15),
                tk.Entry(self.loads_frame, textvariable=loads[2], width=15),
                tk.Entry(self.loads_frame, textvariable=loads[3], width=15),
                tk.Entry(self.loads_frame, textvariable=loads[4], width=15),
                tk.OptionMenu(self.loads_frame, loads[5], *load_locals),
                tk.OptionMenu(self.loads_frame, loads[6], *load_types)])

            self.loads_gui[n][0].grid(row=n+1, column=1)
            self.loads_gui[n][1].grid(row=n+1, column=2, padx = 4)
            self.loads_gui[n][2].grid(row=n+1, column=3, padx = 4)
            self.loads_gui[n][3].grid(row=n+1, column=4, padx = 4)
            self.loads_gui[n][4].grid(row=n+1, column=5, padx = 4)
            self.loads_gui[n][5].grid(row=n+1, column=6)
            self.loads_gui[n][6].grid(row=n+1, column=7)
            n+=1 
Example #27
Source File: beam_patterning.py    From Structural-Engineering with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def add_span(self):
        for widget in self.displace_widget:
            widget.destroy()
        del self.displace_widget[:]
        if self.e_span.get()=='' or self.e_I.get()=='':
            pass
        else:
            self.lb_spans.insert(tk.END,self.e_span.get())
            self.lb_I.insert(tk.END,self.e_I.get())
        if self.e_span.get()=='' or self.lb_spans.size()==1:
            self.load_span.set(1)
            self._reset_option_menu([1])
        else:
            self._reset_option_menu(range(1,self.lb_spans.size()+1))
        
        for i in range(0,self.lb_spans.size()+1):
            self.displace_widget.append(tk.Entry(self.main_frame,width = 5, justify=tk.CENTER))
            self.displace_widget[i].insert(tk.END, '0.0')
            self.displace_widget[i].grid(row=11,column=5+i, padx= 2)
        
        if self.cant_in.get() == 'L' or self.cant_in.get() == 'B':
            self.displace_widget[0].configure(state="disabled")
            self.displace_widget[0].delete(0,tk.END)
            self.displace_widget[0].insert(tk.END, '0.0')
        else:
            self.displace_widget[0].configure(state="normal")
        
        if self.cant_in.get() == 'R' or self.cant_in.get() == 'B':
            self.displace_widget[-1].configure(state="disabled")
            self.displace_widget[-1].delete(0,tk.END)
            self.displace_widget[-1].insert(tk.END, '0.0')
        else:
            self.displace_widget[-1].configure(state="normal")
        
            
        self.ins_validate() 
Example #28
Source File: Frame_2D_GUI.py    From Structural-Engineering with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def add_cant_left_func(self,*event):

        if self.cantL_count == 0:
            self.frame_built = 0
            self.frame_solved = 0
            self.cantL_count +=1
            self.b_remove_left_cant.configure(state=tk.NORMAL)
            self.b_add_left_cant.configure(state=tk.DISABLED)
            self.b_solve_frame.configure(state=tk.DISABLED, bg='red3')
            self.cantL_beam_inputs.append([tk.StringVar(),tk.StringVar(),tk.StringVar(),tk.StringVar()])
            self.cantL_beam_inputs[-1][1].set(5)
            self.cantL_beam_inputs[-1][2].set(29000)
            self.cantL_beam_inputs[-1][3].set(30.8)

            bm = self.cantL_beam_inputs[0]
            bm[0].set('CantL')
            self.beam_labels.append('CantL')
            self.refesh_span_options()

            a = tk.Entry(self.bm_info_tab,textvariable=bm[0], width=8, state=tk.DISABLED)
            a.grid(row=2,column=6)
            b = tk.Entry(self.bm_info_tab,textvariable=bm[1], width=8)
            b.grid(row=2,column=7)
            c = tk.Entry(self.bm_info_tab,textvariable=bm[2], width=8)
            c.grid(row=2,column=8)
            d = tk.Entry(self.bm_info_tab,textvariable=bm[3], width=8)
            d.grid(row=2,column=9)

            self.cantL_beam_gui_list.extend([a,b,c,d])

        else:
            pass 
Example #29
Source File: Frame_2D_GUI.py    From Structural-Engineering with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def build_colup_gui_table(self,*event):
        for element in self.column_up_gui_list:
            element.destroy()

        del self.column_up_gui_list[:]

        for i,col in enumerate(self.column_up_inputs):

            a = tk.Checkbutton(self.colup_info_tab,variable=col[0])
            a.grid(row=i+2,column=1)
            b = tk.Entry(self.colup_info_tab,textvariable=col[1], width=12, state=tk.DISABLED)
            b.grid(row=i+2,column=2)
            c = tk.Entry(self.colup_info_tab,textvariable=col[2], width=8)
            c.grid(row=i+2,column=3)
            d = tk.Entry(self.colup_info_tab,textvariable=col[3], width=8)
            d.grid(row=i+2,column=4)
            e = tk.Entry(self.colup_info_tab,textvariable=col[4], width=8)
            e.grid(row=i+2,column=5)
            f = tk.Entry(self.colup_info_tab,textvariable=col[5], width=8)
            f.grid(row=i+2,column=6)
            g = tk.Checkbutton(self.colup_info_tab,variable=col[6])
            g.grid(row=i+2,column=7)
            h = tk.Checkbutton(self.colup_info_tab,variable=col[7])
            h.grid(row=i+2,column=8)

            self.column_up_gui_list.extend([a,b,c,d,e,f,g,h]) 
Example #30
Source File: Frame_2D_GUI.py    From Structural-Engineering with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def add_cant_right_func(self,*event):
        if self.cantR_count == 0:
            self.frame_built = 0
            self.frame_solved = 0
            self.cantR_count +=1
            self.b_remove_right_cant.configure(state=tk.NORMAL)
            self.b_add_right_cant.configure(state=tk.DISABLED)
            self.b_solve_frame.configure(state=tk.DISABLED, bg='red3')
            self.cantR_beam_inputs.append([tk.StringVar(),tk.StringVar(),tk.StringVar(),tk.StringVar()])
            self.cantR_beam_inputs[-1][1].set(5)
            self.cantR_beam_inputs[-1][2].set(29000)
            self.cantR_beam_inputs[-1][3].set(30.8)

            bm = self.cantR_beam_inputs[0]
            bm[0].set('CantR')
            self.beam_labels.append('CantR')
            self.refesh_span_options()

            a = tk.Entry(self.bm_info_tab,textvariable=bm[0], width=8, state=tk.DISABLED)
            a.grid(row=2,column=11)
            b = tk.Entry(self.bm_info_tab,textvariable=bm[1], width=8)
            b.grid(row=2,column=12)
            c = tk.Entry(self.bm_info_tab,textvariable=bm[2], width=8)
            c.grid(row=2,column=13)
            d = tk.Entry(self.bm_info_tab,textvariable=bm[3], width=8)
            d.grid(row=2,column=14)

            self.cantR_beam_gui_list.extend([a,b,c,d])

        else:
            pass