Python tkinter.StringVar() Examples
The following are 30
code examples of tkinter.StringVar().
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 |
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: application.py From Python-GUI-Programming-with-Tkinter with MIT License | 7 votes |
def load_settings(self): """Load settings into our self.settings dict.""" vartypes = { 'bool': tk.BooleanVar, 'str': tk.StringVar, 'int': tk.IntVar, 'float': tk.DoubleVar } # create our dict of settings variables from the model's settings. self.settings = {} for key, data in self.settings_model.variables.items(): vartype = vartypes.get(data['type'], tk.StringVar) self.settings[key] = vartype(value=data['value']) # put a trace on the variables so they get stored when changed. for var in self.settings.values(): var.trace('w', self.save_settings)
Example #3
Source File: toolkit.py From PickTrue with MIT License | 6 votes |
def __init__(self, master=None, store_name=None, **kwargs): super(FileBrowse, self).__init__(master=master, **kwargs) self.label_text = tk.StringVar() btn = tk.Button(self, text="下载到", command=self.choose_file) btn.pack( side=tk.LEFT, ) tk.Label(self, textvariable=self.label_text).pack( side=tk.LEFT, fill=tk.X, ) self.pack(fill=tk.X) self._store_name = store_name if store_name is not None: self._config = config_store save_path = self._config.op_read_path(store_name) or get_working_dir() else: self._config = None save_path = get_working_dir() self.label_text.set( save_path )
Example #4
Source File: ui_launch.py From Andromeda with MIT License | 6 votes |
def __init__(self, width=500, height=300): TkBase.__init__(self, width, height) self.plist_path = tk.StringVar() self.plist_path.set(os.path.abspath('.')) frame0 = tk.Frame(self.window) frame0.pack() frame1 = tk.Frame(self.window) frame1.pack() frame2 = tk.Frame(self.window) frame2.pack() self.__make_title_info(frame0, 0, 0) self.__make_title(frame1, 0, 1, 'Andromeda.plist 文件目录') self.__make_title_empty(frame1, 1, 0) self.__make_select_text(frame1, 1, 1, 1, self.plist_path) self.__make_title_empty(frame2, 0, 0) self.__make_select_confirm(frame2, 1, 0) self.window.mainloop()
Example #5
Source File: lineSettingsFrame.py From PyEveLiveDPS with GNU General Public License v3.0 | 6 votes |
def addLine(self, settingsList, dpsFrame): lineNumber = len(settingsList) settingsList.append({"transitionValue": "", "color": "#FFFFFF"}) settingsList[lineNumber]["transitionValue"] = tk.StringVar() settingsList[lineNumber]["transitionValue"].set(str(100*lineNumber)) removeButton = tk.Button(dpsFrame, text="X", command=lambda:self.removeLine(lineNumber, settingsList, dpsFrame)) font = tkFont.Font(font=removeButton['font']) font.config(weight='bold') removeButton['font'] = font removeButton.grid(row=lineNumber, column="0") lineLabel = tk.Label(dpsFrame, text="Threshold when the line changes color:") lineLabel.grid(row=lineNumber, column="1") initialThreshold = tk.Entry(dpsFrame, textvariable=settingsList[lineNumber]["transitionValue"], width=10) initialThreshold.grid(row=lineNumber, column="2") initialLabel = tk.Label(dpsFrame, text="Color:") initialLabel.grid(row=lineNumber, column="3") colorButton = tk.Button(dpsFrame, text=" ", command=lambda:self.colorWindow(settingsList[lineNumber], colorButton), bg=settingsList[lineNumber]["color"]) colorButton.grid(row=lineNumber, column="4")
Example #6
Source File: Main.py From python-in-practice with GNU General Public License v3.0 | 6 votes |
def create_variables(self): settings = TkUtil.Settings.Data self.restore = settings.get_bool(GENERAL, RESTORE, True) self.menuImages = {} self.toolbarImages = {} self.toolbars = [] self.toolbarMenu = None self.dockWindows = [] self.dockWindowMenu = None self.statusText = tk.StringVar() self.fontFamily = tk.StringVar() self.fontPointSize = tk.StringVar() self.bold = tk.BooleanVar() self.italic = tk.BooleanVar() self.alignment = tk.StringVar() self.recentFiles = [] self.findDialog = None self.x = self.y = self.dock = None
Example #7
Source File: Preferences.py From python-in-practice with GNU General Public License v3.0 | 6 votes |
def __init__(self, master, options): self.options = options board = self.options.board self.columns = tk.StringVar() self.columns.set(board.columns) self.rows = tk.StringVar() self.rows.set(board.rows) self.maxColors = tk.StringVar() self.maxColors.set(board.maxColors) self.delay = tk.StringVar() self.delay.set(board.delay) self.restore = tk.BooleanVar() self.restore.set(self.options.restore) self.showToolbar = tk.BooleanVar() self.showToolbar.set(self.options.showToolbar) super().__init__(master, "Preferences — {}".format(APPNAME), TkUtil.Dialog.OK_BUTTON|TkUtil.Dialog.CANCEL_BUTTON)
Example #8
Source File: workflowcreator.py From CEASIOMpy with Apache License 2.0 | 6 votes |
def __init__(self, master=None, **kwargs): tk.Frame.__init__(self, master, **kwargs) self.pack(fill=tk.BOTH) self.Options = WorkflowOptions() space_label = tk.Label(self, text=' ') space_label.grid(column=0, row=0) # Input CPACS file self.label = tk.Label(self, text=' Input CPACS file') self.label.grid(column=0, row=1) self.path_var = tk.StringVar() self.path_var.set(self.Options.cpacs_path) value_entry = tk.Entry(self, textvariable=self.path_var, width= 45) value_entry.grid(column=1, row=1) self.browse_button = tk.Button(self, text="Browse", command=self._browse_file) self.browse_button.grid(column=2, row=1, pady=5) # Notebook for tabs self.tabs = ttk.Notebook(self) self.tabs.grid(column=0, row=2, columnspan=3,padx=10,pady=10) self.TabPre = Tab(self, 'Pre') self.TabOptim = Tab(self, 'Optim') self.TabPost = Tab(self, 'Post') self.tabs.add(self.TabPre, text=self.TabPre.name) self.tabs.add(self.TabOptim, text=self.TabOptim.name) self.tabs.add(self.TabPost, text=self.TabPost.name) # General buttons self.close_button = tk.Button(self, text='Save & Quit', command=self._save_quit) self.close_button.grid(column=2, row=3)
Example #9
Source File: data_entry_app.py From Python-GUI-Programming-with-Tkinter with MIT License | 6 votes |
def __init__(self, parent, label='', input_class=ttk.Entry, input_var=None, input_args=None, label_args=None, **kwargs): super().__init__(parent, **kwargs) input_args = input_args or {} label_args = label_args or {} self.variable = input_var if input_class in (ttk.Checkbutton, ttk.Button, ttk.Radiobutton): input_args["text"] = label input_args["variable"] = input_var else: self.label = ttk.Label(self, text=label, **label_args) self.label.grid(row=0, column=0, sticky=(tk.W + tk.E)) input_args["textvariable"] = input_var self.input = input_class(self, **input_args) self.input.grid(row=1, column=0, sticky=(tk.W + tk.E)) self.columnconfigure(0, weight=1) self.error = getattr(self.input, 'error', tk.StringVar()) self.error_label = ttk.Label(self, textvariable=self.error) self.error_label.grid(row=2, column=0, sticky=(tk.W + tk.E))
Example #10
Source File: data_entry_app.py From Python-GUI-Programming-with-Tkinter with MIT License | 6 votes |
def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.title("ABQ Data Entry Application") self.resizable(width=False, height=False) ttk.Label( self, text="ABQ Data Entry Application", font=("TkDefaultFont", 16) ).grid(row=0) self.recordform = DataRecordForm(self) self.recordform.grid(row=1, padx=10) self.savebutton = ttk.Button(self, text="Save", command=self.on_save) self.savebutton.grid(sticky="e", row=2, padx=10) # status bar self.status = tk.StringVar() self.statusbar = ttk.Label(self, textvariable=self.status) self.statusbar.grid(sticky="we", row=3, padx=10) self.records_saved = 0
Example #11
Source File: widgets.py From Python-GUI-Programming-with-Tkinter with MIT License | 6 votes |
def __init__(self, *args, error_var=None, **kwargs): self.error = error_var or tk.StringVar() super().__init__(*args, **kwargs) vcmd = self.register(self._validate) invcmd = self.register(self._invalid) style = ttk.Style() widget_class = self.winfo_class() validated_style = 'ValidatedInput.' + widget_class style.map( validated_style, foreground=[('invalid', 'white'), ('!invalid', 'black')], fieldbackground=[('invalid', 'darkred'), ('!invalid', 'white')] ) self.config( style=validated_style, validate='all', validatecommand=(vcmd, '%P', '%s', '%S', '%V', '%i', '%d'), invalidcommand=(invcmd, '%P', '%s', '%S', '%V', '%i', '%d') )
Example #12
Source File: widgets.py From Python-GUI-Programming-with-Tkinter with MIT License | 6 votes |
def __init__(self, *args, error_var=None, **kwargs): self.error = error_var or tk.StringVar() super().__init__(*args, **kwargs) vcmd = self.register(self._validate) invcmd = self.register(self._invalid) style = ttk.Style() widget_class = self.winfo_class() validated_style = 'ValidatedInput.' + widget_class style.map( validated_style, foreground=[('invalid', 'white'), ('!invalid', 'black')], fieldbackground=[('invalid', 'darkred'), ('!invalid', 'white')] ) self.config( style=validated_style, validate='all', validatecommand=(vcmd, '%P', '%s', '%S', '%V', '%i', '%d'), invalidcommand=(invcmd, '%P', '%s', '%S', '%V', '%i', '%d') )
Example #13
Source File: application.py From Python-GUI-Programming-with-Tkinter with MIT License | 6 votes |
def load_settings(self): """Load settings into our self.settings dict.""" vartypes = { 'bool': tk.BooleanVar, 'str': tk.StringVar, 'int': tk.IntVar, 'float': tk.DoubleVar } # create our dict of settings variables from the model's settings. self.settings = {} for key, data in self.settings_model.variables.items(): vartype = vartypes.get(data['type'], tk.StringVar) self.settings[key] = vartype(value=data['value']) # put a trace on the variables so they get stored when changed. for var in self.settings.values(): var.trace('w', self.save_settings)
Example #14
Source File: application.py From Python-GUI-Programming-with-Tkinter with MIT License | 6 votes |
def load_settings(self): """Load settings into our self.settings dict.""" vartypes = { 'bool': tk.BooleanVar, 'str': tk.StringVar, 'int': tk.IntVar, 'float': tk.DoubleVar } # create our dict of settings variables from the model's settings. self.settings = {} for key, data in self.settings_model.variables.items(): vartype = vartypes.get(data['type'], tk.StringVar) self.settings[key] = vartype(value=data['value']) # put a trace on the variables so they get stored when changed. for var in self.settings.values(): var.trace('w', self.save_settings)
Example #15
Source File: application.py From Python-GUI-Programming-with-Tkinter with MIT License | 6 votes |
def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.title("ABQ Data Entry Application") self.resizable(width=False, height=False) ttk.Label( self, text="ABQ Data Entry Application", font=("TkDefaultFont", 16) ).grid(row=0) self.recordform = v.DataRecordForm(self, m.CSVModel.fields) self.recordform.grid(row=1, padx=10) self.savebutton = ttk.Button(self, text="Save", command=self.on_save) self.savebutton.grid(sticky="e", row=2, padx=10) # status bar self.status = tk.StringVar() self.statusbar = ttk.Label(self, textvariable=self.status) self.statusbar.grid(sticky="we", row=3, padx=10) self.records_saved = 0
Example #16
Source File: application.py From Python-GUI-Programming-with-Tkinter with MIT License | 6 votes |
def load_settings(self): """Load settings into our self.settings dict.""" vartypes = { 'bool': tk.BooleanVar, 'str': tk.StringVar, 'int': tk.IntVar, 'float': tk.DoubleVar } # create our dict of settings variables from the model's settings. self.settings = {} for key, data in self.settings_model.variables.items(): vartype = vartypes.get(data['type'], tk.StringVar) self.settings[key] = vartype(value=data['value']) # put a trace on the variables so they get stored when changed. for var in self.settings.values(): var.trace('w', self.save_settings)
Example #17
Source File: widgets.py From Python-GUI-Programming-with-Tkinter with MIT License | 6 votes |
def __init__(self, *args, error_var=None, **kwargs): self.error = error_var or tk.StringVar() super().__init__(*args, **kwargs) vcmd = self.register(self._validate) invcmd = self.register(self._invalid) style = ttk.Style() widget_class = self.winfo_class() validated_style = 'ValidatedInput.' + widget_class style.map( validated_style, foreground=[('invalid', 'white'), ('!invalid', 'black')], fieldbackground=[('invalid', 'darkred'), ('!invalid', 'white')] ) self.config( style=validated_style, validate='all', validatecommand=(vcmd, '%P', '%s', '%S', '%V', '%i', '%d'), invalidcommand=(invcmd, '%P', '%s', '%S', '%V', '%i', '%d') )
Example #18
Source File: application.py From Python-GUI-Programming-with-Tkinter with MIT License | 6 votes |
def load_settings(self): """Load settings into our self.settings dict.""" vartypes = { 'bool': tk.BooleanVar, 'str': tk.StringVar, 'int': tk.IntVar, 'float': tk.DoubleVar } # create our dict of settings variables from the model's settings. self.settings = {} for key, data in self.settings_model.variables.items(): vartype = vartypes.get(data['type'], tk.StringVar) self.settings[key] = vartype(value=data['value']) # put a trace on the variables so they get stored when changed. for var in self.settings.values(): var.trace('w', self.save_settings)
Example #19
Source File: data_entry_app.py From Python-GUI-Programming-with-Tkinter with MIT License | 6 votes |
def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.title("ABQ Data Entry Application") self.resizable(width=False, height=False) ttk.Label( self, text="ABQ Data Entry Application", font=("TkDefaultFont", 16) ).grid(row=0) self.recordform = DataRecordForm(self) self.recordform.grid(row=1, padx=10) self.savebutton = ttk.Button(self, text="Save", command=self.on_save) self.savebutton.grid(sticky=tk.E, row=2, padx=10) # status bar self.status = tk.StringVar() self.statusbar = ttk.Label(self, textvariable=self.status) self.statusbar.grid(sticky=(tk.W + tk.E), row=3, padx=10) self.records_saved = 0
Example #20
Source File: widgets.py From Python-GUI-Programming-with-Tkinter with MIT License | 6 votes |
def __init__(self, *args, error_var=None, **kwargs): self.error = error_var or tk.StringVar() super().__init__(*args, **kwargs) vcmd = self.register(self._validate) invcmd = self.register(self._invalid) style = ttk.Style() widget_class = self.winfo_class() validated_style = 'ValidatedInput.' + widget_class style.map( validated_style, foreground=[('invalid', 'white'), ('!invalid', 'black')], fieldbackground=[('invalid', 'darkred'), ('!invalid', 'white')] ) self.config( style=validated_style, validate='all', validatecommand=(vcmd, '%P', '%s', '%S', '%V', '%i', '%d'), invalidcommand=(invcmd, '%P', '%s', '%S', '%V', '%i', '%d') )
Example #21
Source File: application.py From Python-GUI-Programming-with-Tkinter with MIT License | 6 votes |
def load_settings(self): """Load settings into our self.settings dict.""" vartypes = { 'bool': tk.BooleanVar, 'str': tk.StringVar, 'int': tk.IntVar, 'float': tk.DoubleVar } # create our dict of settings variables from the model's settings. self.settings = {} for key, data in self.settings_model.variables.items(): vartype = vartypes.get(data['type'], tk.StringVar) self.settings[key] = vartype(value=data['value']) # put a trace on the variables so they get stored when changed. for var in self.settings.values(): var.trace('w', self.save_settings)
Example #22
Source File: better_hello_tkinter.py From Python-GUI-Programming-with-Tkinter with MIT License | 6 votes |
def __init__(self, parent, *args, **kwargs): super().__init__(parent, *args, **kwargs) self.name = tk.StringVar() self.hello_string = tk.StringVar() self.hello_string.set("Hello World") name_label = ttk.Label(self, text="Name:") name_entry = ttk.Entry(self, textvariable=self.name) ch_button = ttk.Button(self, text="Change", command=self.on_change) hello_label = ttk.Label(self, textvariable=self.hello_string, font=("TkDefaultFont", 64), wraplength=600) # Layout form name_label.grid(row=0, column=0, sticky=tk.W) name_entry.grid(row=0, column=1, sticky=(tk.W + tk.E)) ch_button.grid(row=0, column=2, sticky=tk.E) hello_label.grid(row=1, column=0, columnspan=3) self.columnconfigure(1, weight=1)
Example #23
Source File: toolkit.py From PickTrue with MIT License | 5 votes |
def __init__(self, master): tk.Frame.__init__(self, master) self.variable=tk.StringVar() self.label=tk.Label( self, bd=1, relief=tk.SUNKEN, anchor=tk.W, textvariable=self.variable, font=('arial', 16, 'normal') ) self.variable.set('') self.label.pack(fill=tk.X) self.pack(fill=tk.BOTH)
Example #24
Source File: findwindow.py From Tkinter-GUI-Programming-by-Example with MIT License | 5 votes |
def __init__(self, master, **kwargs): super().__init__(**kwargs ) self.geometry('350x100') self.title('Find and Replace') self.text_to_find = tk.StringVar() self.text_to_replace_with = tk.StringVar() top_frame = tk.Frame(self) middle_frame = tk.Frame(self) bottom_frame = tk.Frame(self) find_entry_label = tk.Label(top_frame, text="Find: ") self.find_entry = ttk.Entry(top_frame, textvar=self.text_to_find) replace_entry_label = tk.Label(middle_frame, text="Replace: ") self.replace_entry = ttk.Entry(middle_frame, textvar=self.text_to_replace_with) self.find_button = ttk.Button(bottom_frame, text="Find", command=self.on_find) self.replace = ttk.Button(bottom_frame, text="Replace", command=self.on_replace) self.cancel_button = ttk.Button(bottom_frame, text="Cancel", command=self.destroy) find_entry_label.pack(side=tk.LEFT, padx=(20, 0)) self.find_entry.pack(side=tk.LEFT, fill=tk.X, expand=1) replace_entry_label.pack(side=tk.LEFT) self.replace_entry.pack(side=tk.LEFT, fill=tk.X, expand=1) self.find_button.pack(side=tk.LEFT, padx=(85, 0)) self.cancel_button.pack(side=tk.RIGHT, padx=(0, 30)) top_frame.pack(side=tk.TOP, expand=1, fill=tk.X, padx=30) middle_frame.pack(side=tk.TOP, expand=1, fill=tk.X, padx=30) bottom_frame.pack(side=tk.TOP, expand=1, fill=tk.X)
Example #25
Source File: events.py From Tkinter-GUI-Programming-by-Example with MIT License | 5 votes |
def on_ctrl_d(event=None): top = tk.Toplevel(win) top.geometry("200x200") sv = tk.StringVar() sv.set("Hover the mouse over me") label = tk.Label(top, textvar=sv) label.bind("<Enter>", lambda e, sv=sv: sv.set("Hello mouse!")) label.bind("<Leave>", lambda e, sv=sv: sv.set("Goodbye mouse!")) label.pack(expand=1, fill=tk.BOTH)
Example #26
Source File: ch1-5.py From Tkinter-GUI-Programming-by-Example with MIT License | 5 votes |
def __init__(self): super().__init__() self.title("Hello Tkinter") self.label_text = tk.StringVar() self.label_text.set("Choose One") self.label = tk.Label(self, textvar=self.label_text) self.label.pack(fill=tk.BOTH, expand=1, padx=100, pady=30) hello_button = tk.Button(self, text="Say Hello", command=self.say_hello) hello_button.pack(side=tk.LEFT, padx=(20, 0), pady=(0, 20)) goodbye_button = tk.Button(self, text="Say Goodbye", command=self.say_goodbye) goodbye_button.pack(side=tk.RIGHT, padx=(0, 20), pady=(0, 20))
Example #27
Source File: ch1-3.py From Tkinter-GUI-Programming-by-Example with MIT License | 5 votes |
def __init__(self): super().__init__() self.title("Hello Tkinter") self.label_text = tk.StringVar() self.label_text.set("Choose One") self.label = tk.Label(self, textvar=self.label_text) self.label.pack(fill=tk.BOTH, expand=1, padx=100, pady=30) hello_button = tk.Button(self, text="Say Hello", command=self.say_hello) hello_button.pack(side=tk.LEFT, padx=(20, 0), pady=(0, 20)) goodbye_button = tk.Button(self, text="Say Goodbye", command=self.say_goodbye) goodbye_button.pack(side=tk.RIGHT, padx=(0, 20), pady=(0, 20))
Example #28
Source File: ch1-4.py From Tkinter-GUI-Programming-by-Example with MIT License | 5 votes |
def __init__(self): super().__init__() self.title("Hello Tkinter") self.label_text = tk.StringVar() self.label_text.set("Choose One") self.label = tk.Label(self, textvar=self.label_text) self.label.pack(fill=tk.BOTH, expand=1, padx=100, pady=30) hello_button = tk.Button(self, text="Say Hello", command=self.say_hello) hello_button.pack(side=tk.LEFT, padx=(20, 0), pady=(0, 20)) goodbye_button = tk.Button(self, text="Say Goodbye", command=self.say_goodbye) goodbye_button.pack(side=tk.RIGHT, padx=(0, 20), pady=(0, 20))
Example #29
Source File: program5.py From python-gui-demos with MIT License | 5 votes |
def __init__(self, master): # More advanced as compared to regular buttons # Check buttons can also store binary values self.checkbutton = ttk.Checkbutton(master, text = 'Check Me!') self.checkbutton.pack() self.label = ttk.Label(master, text = 'Ready!! Nothing has happened yet.') self.label.pack() # Tkinter variable classes # self.boolvar = tk.BooleanVar() # boolean type variable of tk # self.dblvar = tk.DoubleVar() # double type variable of tk # self.intvar = tk.IntVar() # int type variable of tk self.checkme = tk.StringVar() # string type variable of tk self.checkme.set('NULL') # set value for string type tkinter variable print('Current value of checkme variable is \'{}\''.format(self.checkme.get())) # setting of binary value for check button: 1. onvaalue and 2. offvalue self.checkbutton.config(variable = self.checkme, onvalue = 'I am checked!!', offvalue = 'Waiting for someone to check me!') self.checkbutton.config(command = self.oncheckme) # creating another tkinter string type variable - StringVar self.papertype = tk.StringVar() # created a variable self.radiobutton1 = ttk.Radiobutton(master, text = 'Paper1', variable=self.papertype, value = 'Robotics Research') self.radiobutton1.config(command = self.onselectradio) self.radiobutton1.pack() self.radiobutton2 = ttk.Radiobutton(master, text = 'Paper2', variable=self.papertype, value = 'Solid Mechanics Research') self.radiobutton2.config(command = self.onselectradio) self.radiobutton2.pack() self.radiobutton3 = ttk.Radiobutton(master, text = 'Paper3', variable=self.papertype, value = 'Biology Research') self.radiobutton3.config(command = self.onselectradio) self.radiobutton3.pack() self.radiobutton4 = ttk.Radiobutton(master, text = 'Paper4', variable=self.papertype, value = 'SPAM Research') self.radiobutton4.config(command = self.onselectradio) self.radiobutton4.pack() self.radiobutton5 = ttk.Radiobutton(master, text = 'Change Checkme text', variable=self.papertype, value = 'Radio Checkme Selected') self.radiobutton5.pack() self.radiobutton5.config(command = self.onradiobuttonselect)
Example #30
Source File: program6.py From python-gui-demos with MIT License | 5 votes |
def __init__(self, master): self.label = ttk.Label(master, text='Enter the text below') self.label.pack() self.entry = ttk.Entry(master, width = 30) # number of characters along the width self.entry.pack() self.button = ttk.Button(master, text = "Get Entry") self.button.pack() self.tkstrvar = tk.StringVar() # create tk string variable self.tkstrvar.set('Nothing is done yet!') # set the value of tk string variable self.button.config(command = self.getEntry) self.msg = ttk.Label(master, text = self.tkstrvar.get()) # get the value of string variable self.msg.pack() self.btn1 = ttk.Button(master, text='Delete the entry', command = self.btn1func) self.btn1.pack() self.crypt = tk.StringVar() self.crypt.set('Encrypt') self.btn2 = ttk.Button(master, text = "{} Text in Entry Field".format(self.crypt.get()), command = self.changecrypt) self.btn2.pack() #self.entryText = ttk.Entry(master, width=30) ttk.Button(master, text = 'Disable Entry Field', command = self.btn3func).pack() ttk.Button(master, text = 'Enable Entry Field', command = self.btn4func).pack() ttk.Button(master, text = 'Readonly Entry Field', command = self.btn5func).pack() ttk.Button(master, text = 'Edit Entry Field', command = self.btn6func).pack()