Questions tagged [tkinter-button]

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.

346 questions
52
votes
11 answers

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

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 2.6.1. The colours of a label…
Anthony Cramp
  • 4,495
  • 6
  • 26
  • 27
3
votes
3 answers

Understanding Python Lambda behavior with Tkinter Button

I would like to understand how a button is working using lambda. I have the following Python code: from tkinter import * def comando_click(mensagem): print(mensagem) menu_inicial = Tk() menu_inicial.geometry("500x250+200+200") botao =…
2
votes
2 answers

How can I reuse logic to handle a keypress and a button click in Python's tkinter GUI?

I have this code: from tkinter import * import tkinter as tk class App(tk.Frame): def __init__(self, master): def print_test(self): print('test') def button_click(): print_test() …
questionto42
  • 7,175
  • 4
  • 57
  • 90
2
votes
1 answer

Tkinter button not showing text

I have a program in which I can launch another program from a menubar. When I launch that program, the buttons have no label, but are functional and the background color of them can be changed. If I start the program regularly, the labels are shown.…
Viraxor
  • 41
  • 5
2
votes
2 answers

Tkinter button background color is not working in mac os

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",…
Akascape
  • 219
  • 2
  • 11
2
votes
0 answers

Can You Implement OSX-Native Tab+Space Navigation with ttk.Button()?

Summarize the Problem I am looking to use tkinter to implement the actions of tabbing and using the spacebar to cycle and activate UI elements, respectively. I am hoping to do so in a way that mimics the native behavior of OSX, as seen in the…
2
votes
1 answer

How to create a scrollable list of buttons in Tkinter?

The code I have now will only print the buttons, it will not create a scroll bar. I want it to print the buttons and allow me to scroll through them. The best I could do is create the scroll bar, but not get it to attach to anything? I'm new to…
2
votes
1 answer

Binding button to label widget

Trying to call hii function in python tkinter, but nothing happens. My Code:- def hii(): print("hii") m_root = Tk() m_frame = Frame(m_root) m_display = Label(m_frame) label = Label(m_root,text="hii") #set your…
Deoj
  • 71
  • 1
  • 5
2
votes
2 answers

Executing a Button command from another file?

I have started working on a GUI system where I need to import a function from one file to be executed in the main file when a button is pressed, but every time I run it I get: AttributeError: partially initialized module 'Two' has no attribute…
Jumanji176
  • 47
  • 9
2
votes
0 answers

Radiobutton for tkinter only works for last selection

I'm making a character creator and I need to ask the user what their character's gender is. I have lists of pronouns to refer to depending on the gender, but for some reason, they are only effective with the last option. I've been using radiobuttons…
chris
  • 21
  • 1
1
vote
0 answers

How can I make the label widget background transparent or remove it completely on python Tkinter

I am new to using Tkinter, and I have been searching for a solution to remove the background color of the label widget for quite some time. Despite my efforts, I haven't been able to find a straightforward solution. I've tried various configurations…
1
vote
2 answers

How to get rid of spaces ? tkinter

I want to make "=" button higher so it cover the space above(also wanna make "." wider so it also covers space) what I am getting so I want to join the cell above "=" and cell next to ".", wanna make one "big" button window =…
Eric
  • 11
  • 2
1
vote
1 answer

Tkinter How to make one button of radiobuttons do as a menubutton?

enter image description hereI have a group of buttons that work together as radiobuttons, and I try to make the last one of them open a menu like menubutton Or at least make the menubutton separate and make it work by clicking a button in the…
1
vote
1 answer

Why is my boolean variable not updating when changed within functions in my tkinter custom scrollbar widget?

I am trying to make a custom scrollbar widget for tkinter in Python3. I'm using classes and functions to organise my code. I have a boolean variable that needs to be accessed by the rest of the program to determine whether the scrollbar is active so…
1
vote
2 answers

How to put a tkinter canvas item in top of other tkinter widgets placed in the same canvas?

I am trying to put a tkinter widget (placed inside canvas) behind a canvas item. I tried tag_raise method but it is not working. Moreover, I want them in the same canvas. Is there any other possible way? import tkinter root = tkinter.Tk() canvas =…
Akascape
  • 219
  • 2
  • 11
1
2 3
22 23