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.
Related
CleanMyMacX image
As you can see, some of the buttons are outside of the window, and the window's title isn't visible. I am wondering if this is possible to do in python tkinter, and if so, how to do it.
Thanks!
I have created a ttk Notebook with multiple tabs. Each of the tab contains data that user needs to enter. What I would like to do is to change the colour of the tabs, based on a user button click.
Say, initially all the tabs are red. I have an update button for each tab, and when the user clicks this, the tab colour should change to green. I would like the user to know which all tabs are complete, and whch are not.
Is ther any way this is possible? I tried configuring the ttk.Style(), but it affects the entire notebook.
You can simple to it by change the color of the Button
Here is a simple example that can help you
from tkinter import *
root=Tk()
def click():
btn.config(bg='green')
btn=Button(root,text='Update',bg='red',command=click)
btn.pack()
root.mainloop()
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().
So basically I have a window thats just a vertical list of buttons. I want to create a dropdown menu that goes off to the side without changing the size of the window. I am trying to do this with popover, but now I have the problem where my popover gets cut off by the window. Is there a way I can make it bleed past the window boundaries?
Popovers don't go wider than the parent window. You could have a try at a GtkMenu. They are allowed to go wider than the window, up to the width of the monitor.
I am aiming to change the a part of the Tkinter screen when a button is clicked. Do I have to destroy the screen then redraw it (to create the illusion that only a part is being changed?) Or can I keep the button there and somehow only change one part (like the graphics.) Thanks!
No, you do not have to destroy the screen and redraw it. You can easily insert widgets into the current window when a button is clicked. There's nothing special about being run from a button click -- the code is the same as your initialization code.