tkinter-button

Why is my command function not being called when I press a button?

Why is my command function not being called when I press a button? Question: I’m a bit of a newbie to Tkinter, so bear with me. I’m making a simple game which involves buttons laid out in a grid. When one of these buttons is press, depending on their position, they move to a different …

Total answers: 1

when generating text the text displays <function s at 0x000001B240AB3E2> how can I display the generated thing properly in tkinter python?

when generating text the text displays <function s at 0x000001B240AB3E2> how can I display the generated thing properly in tkinter python? Question: from ctypes.wintypes import SIZE from tkinter import * # import tkinter import secrets window = Tk() # creates window window.title(‘PassGen’) # changes title window.geometry(‘600×400’) # sets size window.resizable(False,False) # prevents user from changing …

Total answers: 2

How to prevent tkinter buttons from moving when label text length change?

How to prevent tkinter buttons from moving when label text length change? Question: I have the following example: from tkinter import * number = 0 ​ window = Tk() window.title("Program") window.geometry(‘350×250’) ​ label = Label(window, text=number) label.grid(column=0,row=0) ​ def clicked_up(): global number number += 1 label.config(text=number) ​ def clicked_down(): global number number -= 1 label.config(text=number) …

Total answers: 1

Button causing Tkinter Window to Crash (Python)

Button causing Tkinter Window to Crash (Python) Question: I started learning python a few days ago and I have been messing around with Tkinter. I have been making a cookie-clicker type of game to practice what I learned. Everything worked except for a button that when clicked should start adding 1 point every 30 seconds. …

Total answers: 1

How do I remove the border of a Image Button in Tkinter?

How do I remove the border of a Image Button in Tkinter? Question: I know how to remove the border of a Tkinter Button and Image. It is done pretty much exactly like how you do it for everything else borderwidth=0 What I need help with if why, even though I put that in the …

Total answers: 2

Tkinter button background color is not working in mac os

Tkinter button background color is not working in mac os Question: I am trying to change the bg color of a tkinter button on my mac (catalina) but instead of getting a colored background, it is showing a blank white space in the layout. The button code I used: button_open = Button(root, width=45, bg="#82CC6C", fg="black", …

Total answers: 2

Tkinter: Remove active button highlight

Tkinter: Remove active button highlight Question: How can I remove the dotted black border after a button is clicked in Tkinter (with Ttkthemes)? I’m on Windows 10, Python 3.7.9. There seems to be no uniform way to remove it and I searched across Google and SO with no luck. Thanks. Here’s a minimal example: import …

Total answers: 2

Why is my button working even though I haven't assigned any parent window to it?

Why is my button working even though I haven't assigned any parent window to it? Question: Why is my button working even though I haven’t assigned any parent window to it? from tkinter import * root = Tk() Button(text=’MyButton’).pack() root.mainloop() Asked By: Ayush Singh || Source Answers: Widgets live in a tree-like hierarchy with a …

Total answers: 1

How to change the foreground or background colour of a Tkinter Button on Mac OS X?

How to change the foreground or background colour of a Tkinter Button on Mac OS X? Question: I’ve been working through the Tkinter chapters in Programming Python and encountered a problem where the foreground and background colours of a button will not change. I am working on a Mac OS X 10.6 system with Python …

Total answers: 10