Use this tag when you are referring to the tkinter button, created with the function tkinter.Button(). DON'T USE THIS TAG TO REFER TO ANY OTHER BUTTON.
Questions tagged [tkinter-button]
346 questions
0
votes
1 answer
Tying a python tkinter button command, to open a specific link, in a list of links?
I am using a for loop to layout a 3 x 3 grid of buttons in the create_widgets() function.
I am having trouble linking each specific button to a link in the 'link_list' (in the dunder init method).
In my code, it (understandably) tries to index the…

Sam Katz
- 1
0
votes
1 answer
Tkinter call up a function with a button or with a key
I need to create a function that starts when I press a botton of the GUI or when I press a key like ENTER. It's possible?
I have created the single functions that perform one of these 2 cases, can I merge them? I am attaching the code for better…

daav_v
- 25
- 6
0
votes
0 answers
Tkinter how to fix non symmetrical button
As you can see in the picture, everything is aligned properly, but the equation button is not symmetrical in size from both sides. For example if I change the equation character to a number, then everything is perfect. I tried to search if I could…

LostHat
- 33
- 5
0
votes
1 answer
Switch frames in Tkinter without a button
I'm using the following code to create a Tkinter window and switch the frames it displays.
import tkinter
class GUI(tkinter.Tk):
def __init__(self):
tkinter.Tk.__init__(self)
self._frame = None
self.switch(Frame1)
…

Martin007
- 19
- 9
0
votes
1 answer
Problem with dynamically changing which command a button calls in tkinter
In this simple calculator GUI, I'm creating a frame template using classes. The frame has 2 labels, 2 entry boxes, and a button. I'd like the button to run a specific command depending on the function_call variable passed when initializing - but…

PelicanSquirrel
- 1
- 1
0
votes
3 answers
Is it possible to reduce a button size in tkinter?
I'm working on a little text editor and currently making the buttons, on the picture bellow the 'B' button for bold. I would like to reduce his size in order to make him fit his true size, like a square box, and get rid of the extra-height.
How…

atrefeu
- 178
- 11
0
votes
1 answer
I'm trying to make a simple math thing but it gives me an error
I'm trying to make a simple math thing that when you give the right answer it says 'correct' and when you get it wrong it says 'wrong'; however, it gives an error:
Exception in Tkinter callback
Traceback (most recent call last):
File…

Walt Fu
- 11
- 3
0
votes
1 answer
how to remove a button of grid when it is clicked in tkinter
I am trying to arrange a sentence which have a few words onto grid button.
When a word of that sentence is clicked, I want to remove that word of grid button after that is moved to another row of grid button.
How to remove only that grid button…

Jongkeun Choi
- 43
- 8
0
votes
1 answer
How can I get the value of a button clicked
I have some python code which generates buttons using the data in my SQL table. Is there a way I can get the text of the button I have selected, as the code I have will only retrieve the last value in the for loop. I can not make a variable for each…

Julia
- 69
- 8
0
votes
0 answers
Is it better etiquette to create the Buttons and Labels outside of the functions and just grid them inside when needed for Tkinter?
For example, I am trying to create a greetings Label that says "Welcome to ..." so is it better to do:
def main():
greeting = Label(root, text="Welcome to tictactoe! Player1 choose your letter:")
greeting.grid(row=0, column=0)
or include…

Sproll
- 1
- 1
0
votes
2 answers
Tkinter button command doesn't work when clicked
I am making a program that searches a list of stock numbers(the first 8 digit int in the list) and then returns the rest of the values in the list inside the entry boxes but when I click the search button, it does not perform its function. Any…

wF121
- 3
- 2
0
votes
1 answer
How to properly use buttons in tkinter with same window
This is my first day using tkinter, and I wanted to know how to properly code what I have done.
What I wanted to make was a kind of diaporama so I wanted to find a way to display pictures in a canvas and have two buttons so I could go to the…

Axel
- 129
- 1
- 6
0
votes
2 answers
How can I use the array of one function into another function in python tkinter?
I want to generate a random array in a function. After that I want to sort this array in another function. How I can I access the array in second function?
from tkinter import *
import array as arr
import numpy as np
import random
root = Tk()
…
0
votes
1 answer
How do I change background colour of a button on hover in Tkinter?
I want to change my background and foreground colour of a button on mouse cursor hover in the Python Tkinter module. I am able to change the background colour of the button once before packing it to the main window.
But after the window.mainloop()…

Spectre
- 3
- 3
0
votes
1 answer
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?
from tkinter import *
root = Tk()
Button(text='MyButton').pack()
root.mainloop()

Ayush Singh
- 3
- 2