tkinter.optionmenu

Python tkinter cut down path but open as full directory

旧城冷巷雨未停 提交于 2021-01-29 11:52:29
问题 Here is my full Python code: from tkinter import * import glob import os from PIL import Image, ImageTk, ImageGrab import tkinter as tk import pyautogui import datetime #date & time now = datetime.datetime.now() root = tk.Tk() root.title("SIGN OFF") root.minsize(840, 800) # Add a grid mainframe = tk.Frame(root) mainframe.columnconfigure(0, weight=1) mainframe.rowconfigure(0, weight=1) mainframe.pack(pady=100, padx=100) # Create a Tkinter variable tkvar = tk.StringVar(root) # Directory

ttk.OptionMenu outer border around the menu

旧巷老猫 提交于 2021-01-28 20:01:14
问题 I try to style a tkinter gui, first this gui is not easy to modify. I reach the styling i want for the widgets i use, except for one think. I get lock about this light gray border around the Menu in the ttk.OptionMenu widget. How removing or coloring it ? Python 3x on Windows 10 Here just the relevant parts of the code. Some common styling: self.style = ttk.Style(self) self.style.theme_use("clam") self.font12 = tkFont.Font(family="helvetica", size=12) self.font14 = tkFont.Font(family=

get rid of white border around option menu

我怕爱的太早我们不能终老 提交于 2020-08-27 02:18:16
问题 I'm trying to get rid of the white border around the OptionMenu . What I tried I changed the colour to red, but there is still a white border around it. Can anyone help? Here's the code: from tkinter import * import tkinter as tk from tkinter import ttk root = tk.Tk() root.geometry('500x500') var = StringVar() option = ttk.OptionMenu(root,var,'1','2','3') option["menu"].config(bg="red") option.pack() root.mainloop() Also, is there a way to change the colour of the OptionMenu trigger box (In

get rid of white border around option menu

倖福魔咒の 提交于 2020-08-27 02:18:07
问题 I'm trying to get rid of the white border around the OptionMenu . What I tried I changed the colour to red, but there is still a white border around it. Can anyone help? Here's the code: from tkinter import * import tkinter as tk from tkinter import ttk root = tk.Tk() root.geometry('500x500') var = StringVar() option = ttk.OptionMenu(root,var,'1','2','3') option["menu"].config(bg="red") option.pack() root.mainloop() Also, is there a way to change the colour of the OptionMenu trigger box (In

Tkinter bringing chosen option from optionMenu into a variable for further use

与世无争的帅哥 提交于 2020-06-21 05:36:09
问题 when creating a drop-down menu in "tkinter" like this: options = ['0', '1', '2', '3', '4'] option = tk.OptionMenu(menu, var, *options) var.set('Select number') I want to know exactly how I can take the integer that the user has chosen and turn it into a variable that I can use later on. 回答1: Question : how I can take the integer that the user has chosen You define options as a list of str , therefore the chosen option are assigned to the given textvariable , in your code var . To get a

Tkinter OptionMenu cant use .get in a function

烂漫一生 提交于 2020-06-09 06:58:28
问题 I'm writing some code and i need a variable to change when the optionMenu is changed here is some of my code below #!/user # -*- coding: utf-8 -*- import locale import Tkinter as Tk root = Tk.Tk() root.title("My Tax Calculator") root.geometry("700x225") def getStudentLoan(): global StudentLoan StudentLoan = StudentLoanLi.get() LeftFrame = Tk.Frame(root, width=300, height=200, pady=3) Placeholder2 = Tk.Label(LeftFrame, text="") Placeholder2.grid(row=2, column=1) StudentLoanOp = Tk.StringVar()

Updating OptionMenu from List

拟墨画扇 提交于 2020-01-27 04:18:25
问题 I have an OptionMenu in my GUI that is being populated by a list. Every time the user runs a certain process the list updates to reflect this. Is there a way to update the OptionMenu based on the list? I've tried self.plotWindow.update() as per this question but to no avail. However, closing and reopening the window does refresh the OptionMenu as you would expect. Relevant code: if self.figNum.get() == 'New Figure...': if self.figList[-1] == 'New Figure...': self.figList.append(1) else: self

How to make border around ttk.OptionMenu

烈酒焚心 提交于 2020-01-24 09:50:27
问题 While trying to make an entry frame I ran into a problem where I can't make border around ttk.OptionMenu in order to make it look similiar to ttk.Entry. (The two next to each other are in image) Making OptionMenu option = ttk.OptionMenu(bottom_container, self.have, 'ANY', 'ANY', '0', '1', style='vista.TMenubutton') option.grid(column=1, row=2, sticky='we') I tried using styles (want to still use vista/winnative look) and was able to make the optionmenu background white, but I couldn't find a