Bottom Page

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 change background color of button
#1
Starting to learn Python though I know other languages such as VB.NET

I create 5 buttons.
tkinter.Button(Gui, "1", command=callback).grid(row=0, column=1)
...

tkinter.Button(Gui, "5", command=callback).grid(row=0, column=5)

When I click on any of the 5 buttons, I want to change its background color.

I don't know how to write a generic callback function that changes the background color for only the button that was clicked.
Quote

Top Page

Messages In This Thread
change background color of button - by ieee488 - Jul-27-2019, 11:21 PM
RE: change background color of button - by wuf - Jul-28-2019, 08:44 AM
RE: change background color of button - by ieee488 - Jul-30-2019, 09:49 PM

Possibly Related Threads...
Thread Author Replies Views Last Post
  Restoring Tkinter widget background to original color pythonprogrammer 1 273 Dec-16-2019, 04:59 AM
Last Post: woooee
  Make Label Text background (default color) transparent using tkinter in python barry76 1 3,257 Nov-28-2019, 10:19 AM
Last Post: Larz60+
  [Tkinter] changing background color of a button ieee488 2 577 Sep-06-2019, 01:24 PM
Last Post: ieee488
  [PySimpleGui] How to alter mouse click button of a standard submit button? skyerosebud 3 664 Jul-21-2019, 06:02 PM
Last Post: FullOfHelp
  [WxPython] How to change font color of SetHint or SetDescriptiveText? anistorian 5 876 Jun-19-2019, 05:30 PM
Last Post: Yoriz
  [Tkinter] So what do I need to do change the color this label? jpezz 10 1,159 Apr-03-2019, 09:49 PM
Last Post: jpezz
  Can't change the colour of Tk button text Pilover 4 3,056 Feb-27-2019, 09:02 PM
Last Post: Pilover
  set button background with image of window background gray 3 8,784 Oct-18-2017, 08:22 AM
Last Post: gray
  Change color of a row of a QTableView? panoss 7 16,773 Sep-23-2017, 03:02 PM
Last Post: Mafireyi
  [Tkinter] Selected radio button in push button in Tkinter prashantfunde91 1 7,416 Jun-22-2017, 05:27 PM
Last Post: DeaD_EyE

Forum Jump:


Users browsing this thread: 1 Guest(s)