I am trying to write code that you can turn a normal Tkinter button into a dropdown menu but the dropdown menu button is in the main window, not in the menu bar. kind of like notepad++ how the menu bar is on the window, but I am making a dropdown button like that but that shows in the window. Can someone help? I don't really know how to explain this, but I am a beginner. I am using python and Tkinter on pycharm on a mac.
here is a video I made to explain more:
https://www.hippovideo.io/video/play/nuvNU03a6Hg7_oQC39uy1wgopPijjQQGCLH18VC0KiA
You can create popup-menus with menu.tk_popup(x, y).
So just add master.bind('<Button-3>', lambda e:menu.tk_popup(x, y).
x and y are values which you choose. If you want to place the menu at the mouse-pointer, you can use master.geometry(), but to be honset, I have no idea how to use master.geometry() exactly. But there are other Solutions too, e.g. tkinter.Spinbox().
Related
I want to edit the system menu in the Tkinter window to show custom options. When I say system menu, I mean this, the menu that can be opened by right-clicking the title bar of a window, not this, the dropdown menu in a window.
I want to be able to add as many options as I like, not just the default ones(shown below).
May I know how I can do that? Thanks.
I have a custom shelf in Maya with buttons built using the 'shelfButton' command. I would like to include short descriptions of what the button does when the mouse cursor hovers over the button. I have tried a couple of the available flags, like 'annotation,' but so far I have not gotten anything useful.
shelfButton command inside Maya has no flag for the desired behavior. Any string passed with the annotation flag will be displayed on Maya's native help box (At the buttom of the Maya UI). If you really want the behavior you may have to look into Qt.
I am creating a GUI that contains a drop-down box (called an optionmenu in tkinter). I have it populated with entries.
This is what I want to do but can't figure out the proper commands. If a user hovers their mouse over a specific entry in the option menu, I want a hoverbox/balloon box/tooltip (whatever you want to call it) to appear and show a description of the option they are hovering over.
I assume I have to use some sort of event but I am not sure. Does anyone know how?
I have a customized button, on which I loaded an icon like this:
but as you can see there's a "box" around the button. The icon itself doesn't have background, so I guess the box is added by tkinter to indicate that this is a button. Is there a way to make those four lines disappear?
Thanks in advance.
I don't know How structure the GUI of my program...
I don't have big experience with GUI programming, i know all the widgets, the
geometry managers, the "object-oriented" method in Tkinter, but i don't understand
how combine all this things...
I want to create a program with an image in background where there is a button and if i press this button i switch in another page and the button disappears
Like this : https://moqups.com/iampirla#gmail.com/wyM7CyET/p:a80e8d902
How i can structure my code to do this?
You could use pack_forget() this removes the widget although allows you to use it later if you wish. You could do the first page and then use some code like below. To clear the page. This could then reference the next thing you wish to do using in this example question().
def answred():
nameLabel.pack_forget()
nameEntry.pack_forget()
nameButton.pack_forget()
classQuestion.pack_forget()
button1.pack_forget()
button2.pack_forget()
button3.pack_forget()
question()
You could this but not remove the background widgets