BUTTON
Eigenschaften

Erzeugen:
bn = tkinter.Button(self)

Beschriftung:
self.bn["text"] = "Ok"

Event:
self.bn["command"] = self.onClickTheButton

Layout-Manager:
self.bn.pack oder self.bn.grid()

ActiveBackground:
self.bn.config(activebackground= "yellow")
funktioniert nicht bei Tests

ActiveForeground:
self.bn.config(activeforeground = "green")
funktioniert nicht bei Tests

Background:
self.bn.config(background = "green")
self.bn.config(background = "#FF0000")
self.bn.config(bg = "#FF0000")

Foreground:
self.bn.config(foreground="red")
self.bn.config(fg="red")

Borderwidth:
self.bn.config(borderwidth="2") #pixel

Borderwidth:
self.bn.config(bd="2") # pixel

Height:
self.bn.config(height="2") # Textzeilen

Justify:

self.bn.config(justify("left")
self.bn.config(justify("right")
self.bn.config(justify("justify")
overrelief:
self.bn.config(overrelief="raised") Mouse Hover
sunken
flat
ridge
solid
groove

relief:
self.bn.config(relief="raised")
sunken
flat
ridge
solid
groove

state:
self.bn.config(state="normal")
active
enabled
disabled

Takefokus:
self.bn.config(takefocus=bool)
Kann Fokus erhalten?Text: self.bn["text"] = Caption

Textvariable:
self.bn["textvariable"] = Caption
Property für den Schalter




Beispiel

import tkinter
# from Tkinter import *

class MyApp(tkinter.Frame):

	def __init__(self, master=None):
		tkinter.Frame.__init__(self, master)
		self.pack()
		self.setGUI()

	def setGUI(self):
		buttonframe = tkinter.Frame(self)  # „JPanel“ fuer die Eingabe
		buttonframe.config(background = "blue") 
		# ohne expand, da fill=“x“
		buttonframe.pack(fill="x", side="bottom" )


		self.bnEsc = tkinter.Button(buttonframe)
		self.bnEsc["text"] = "Beenden"
		self.bnEsc["command"] = self.quit
		self.bnEsc.pack(padx="5", side="right")

		self.bnAction = tkinter.Button(buttonframe)
		self.bnAction["text"] = "Action"
		self.bnAction["command"] = self.onAction
		self.bnAction.pack(side="right")
		self.bnAction.config(foreground= "green")
		#self.bnAction.config(borderwidth="5") 
		self.bnAction.config(activebackground= "yellow")
		self.bnAction.config(height="5") 

	def onAction(self):
		str = self.var_name.get()
		messagebox.showinfo( "Hello Python", str)
		self.editor.insert("end",str+"\r\n")


root = tkinter.Tk()
root.title("Button")
root.geometry("250x150")
app = MyApp(root)
app.mainloop()

Layout grid
Checkbutton