Questions tagged [tkinter-menu]
86 questions
7
votes
4 answers
What does the 'tearoff' attribute do in a tkinter Menu?
I often see Tkinter applications initialize Menu widgets using tearoff=0 in the constructor.
import tkinter as tk
root = tk.Tk()
menubar = tk.Menu(root)
filemenu = tk.Menu(menubar, tearoff=0)
effbot.org's documentation for Menu specifies that…

Stevoisiak
- 23,794
- 27
- 122
- 225
4
votes
2 answers
How to activate tkinter menu and toolbar with keyboard shortcut/binding?
I have a file menu in tkinter and when I click on it a file menu opens. I also want the menu to open with a keyboard short-cut like "alt+f" for example instead of clicking it.
Here is the code:
def Open_FileMenu_With_KeyboardShortcut():
pass
…

Skcoder
- 299
- 1
- 9
2
votes
1 answer
Trying to add menu option using tkinter
Trying to add menu option but my code crash. tried multiple ways to add but not sure how to do that. any hint will helpful.!!!
I tried many ways posted on google also tried to write some code but somewhere it's fail to bind Menu and Tkinter
Any…

Kratika Varshney
- 35
- 4
2
votes
1 answer
How do you make a drop down menu in Tkinter?
I have a quick question, how would you make a drop down menu in Tkinter like the one below:
This menu has a drop down option, how would you add a drop down in tkinter here is my code:
# Menu Bar
MenuBar =…

Skcoder
- 299
- 1
- 9
2
votes
0 answers
Is it possible to change the menu border color in tkinter
I want to change the border color of the drop down menu items.
white theme:
Using Python 3.7 and tkinter - my GUI app offer both dark and light themes, so I change the background and foreground colors dynamically. I was able to do it for most…

MSE
- 625
- 9
- 19
2
votes
1 answer
Tkinter: Adding icon into menu items
I have a perfectly functional TkInter right click context menu, with 4 items and 1 separator, however I am trying to find out how to be able to display an icon with each item, I have managed to get the items to show as icons but this removes…

Dylan Logan
- 395
- 7
- 18
2
votes
1 answer
How to use defined variables in __init__ method all over the code?
Here, I am trying to build a text editor using python and tkinter and OOP. But the problem is I am unable to use predefined variables in the code.
from tkinter import *
from tkinter import Tk, Menu, Label, PhotoImage, StringVar, IntVar
from PIL…

S. Kalyankar
- 31
- 3
1
vote
1 answer
How to change the background color of menubar of Tkinter Widget
I'm trying to change the background color of the menubar that I made using the Tkinter widget, I changed the background color of the title-bar thanks to a solution that I came across on StackOverflow even tho it wasn't for windows 10 but it worked…

OverRevvv
- 13
- 3
1
vote
0 answers
How to use tk.menu.unpost under windows
The question is how to use the tk.menu.unpost method under windows.
The code:
if __name__ == "__main__":
from tkinter import Menu, Tk, Label
t = Tk()
label = Label(t, text="Label")
label.pack()
menu = Menu(t,…

srccircumflex
- 71
- 5
1
vote
0 answers
How can i destroy my main loop and create a new one from another window in tkinter
I Have a signin form and after signing in I created a tray and hide signing form ...how can I destroy my old master and create a new one from tray.py?
for eg:- i have a file main.py in which I am showing form like -
import tkinter as tk
from signin…

Intellial solutions
- 23
- 5
1
vote
1 answer
Closing current window when opening a new window in tkinter python
I have created a program in Python using tkinter. I have created two seperate classes for two windows. I am opening the other window by clicking on the button of one window. I want it such that when new window opens the other should close. My code…

Anmol
- 57
- 1
- 7
1
vote
1 answer
How to get grid to stretch inside containers in tkinter
I am trying to use python to create a program that will control pumps in a device later on and I'm now just trying to understand how to build a GUI using tkinter.
I have gotten everything to show up, except that I can't make the buttons stretch with…

Rickard
- 15
- 4
1
vote
0 answers
Program keeps running before i can enter data
The issue is that I have a login window for a quiz created as a function but whenever i call the fuction, the code continues into the quiz before i can enter any information into the login.
This causes an error:
Traceback (most recent call…

Thomas Noott
- 11
- 1
1
vote
2 answers
How to check if Menu item exists in Python Tkinter
On python tkinter I have the following code for creating a Menu with only 2 menu items:
my_menu = Menu(root, tearoff=False)
my_menu.add_command(label="Show details", command=whatever)
my_menu.add_command(label="Delete me", command=something)
Now I…

Kleiton Kurti
- 153
- 8
1
vote
1 answer
Tkinter - Optionmenu - Is it possible to change the indicator arrow when the dropdown box is clicked by the user?
I have managed to change the indicator within the optionmenu box through using indicatoron=0, compound=RIGHT, image=dropImg, width=120 but I am now trying to change the arrow to point up when the box is clicked and the list of elements are…

Jacob
- 25
- 10