SPINBOX
Eigenschaften

Anwendung:
Auswahl von festen Elementen à la ComboBox, JSpinner
Numerisch ODER Alphanumerisch

Erzeugen:
self.spinbox = tkinter.Spinbox(inputframe, from_=0, to=10)
self.spinbox = tkinter.Spinbox(inputframe,values = ("1.0","1.3","1.7","2.0","2.3","2.7","3.0"))
self.spinbox = tkinter.Spinbox(inputframe)
self.spinbox.config(values = ("AI","VW","W"))

Setter/Getter:
self.var_spinbox = tkinter.IntVar() # numerisch
self.var_spinbox.set(0)
self.spinbox["textvariable"] = self.var_spinbox

self.var_spinbox = tkinter.StringVar() # alphanumerisch
self.var_spinbox.set("AI")
self.spinbox["textvariable"] = self.var_spinboxLayout-Manager:
self.inputui.pack oder self.textui.grid()

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

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

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

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

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

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

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

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

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

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




Beispiel Numerisch
# coding=utf8

import tkinter
from tkinter import messagebox

# http://www.tutorialspoint.com/python/tk_spinbox.htm

# Dialog with a spinbox
# Spinbox is a numeric spinbox with the range from 0 to 10

class MyApp(tkinter.Frame):

	def __init__(self, master=None):
		tkinter.Frame.__init__(self, master)
		self.pack(expand=True, fill="both")
		self.setGUI()

	def setGUI(self):
		inputframe = tkinter.Frame(self)
		inputframe.background = "red" #"#FF0000"
		inputframe.pack(expand=True,fill="x", side="top" )

		self.label1 = tkinter.Label(inputframe)
		self.label1["text"] = "Eingabe"
		self.label1.bd = 10  # border width
		self.label1.fg = "blue" #"#FF0000"  # foreground
		self.label1.bg = "#FF0000"   # backcolor
		self.label1.pack(side="left")
	
		self.spinbox = tkinter.Spinbox(inputframe, from_=0, to=10)
		self.spinbox.activebackground = "blue"
		self.spinbox.pack(expand=True,fill="x",padx="5",pady="5")
		
		self.var_spinbox = tkinter.IntVar()
		self.var_spinbox.set(0)
		self.spinbox["textvariable"] = self.var_spinbox

		buttonframe = tkinter.Frame(self)
		buttonframe.pack(expand=True,fill="x", side="top" )

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

		self.bnAction = tkinter.Button(buttonframe)
		self.bnAction["text"] = "Action"
		self.bnAction["command"] = self.onAction
		self.bnAction.pack(side="right",padx="5")

	def onAction(self):
		iValue = self.var_spinbox.get()
		iValue=iValue+1
		messagebox.showinfo( "Hello Python", iValue)




root = tkinter.Tk()
root.title("Spinbox 1")
root.geometry("250x100")
app = MyApp(root)
app.mainloop()


Beispiel Alphanumerisch
# coding=utf8

import tkinter
from tkinter import messagebox

# http://www.tutorialspoint.com/python/tk_spinbox.htm

# Dialog with a spinbox
# Spinbox is a list-spinbox with the values (tuples)

class MyApp(tkinter.Frame):

	def __init__(self, master=None):
		tkinter.Frame.__init__(self, master)
		self.pack(expand=True, fill="both")
		self.setGUI()

	def setGUI(self):
		inputframe = tkinter.Frame(self)
		inputframe.background = "red" #"#FF0000"
		inputframe.pack(expand=True,fill="x", side="top" )

		self.label1 = tkinter.Label(inputframe)
		self.label1["text"] = "Eingabe"
		self.label1.bd = 10  # border width
		self.label1.fg = "blue" #"#FF0000"  # foreground
		self.label1.bg = "#FF0000"   # backcolor
		self.label1.pack(side="left")
	
		self.spinbox = tkinter.Spinbox(inputframe,values = ("1.0","1.3","1.7","2.0","2.3","2.7","3.0"))
		self.spinbox.activebackground = "blue"
		self.spinbox.pack(expand=True,fill="x",padx="5",pady="5")
		
		self.var_spinbox = tkinter.DoubleVar()
		self.var_spinbox.set(1.0)
		self.spinbox["textvariable"] = self.var_spinbox

		buttonframe = tkinter.Frame(self)
		buttonframe.pack(expand=True,fill="x", side="top" )

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

		self.bnAction = tkinter.Button(buttonframe)
		self.bnAction["text"] = "Action"
		self.bnAction["command"] = self.onAction
		self.bnAction.pack(side="right",padx="5")

	def onAction(self):
		dValue = self.var_spinbox.get()
		messagebox.showinfo( "Hello Python", dValue)




root = tkinter.Tk()
root.title("Spinbox 2")
root.geometry("250x100")
app = MyApp(root)
app.mainloop()


Beispiel Alphanumerisch
# coding=utf8

import tkinter
from tkinter import messagebox

# http://www.tutorialspoint.com/python/tk_spinbox.htm

# Dialog with a spinbox
# Spinbox is a list-spinbox with the values (tuples)

class MyApp(tkinter.Frame):

	def __init__(self, master=None):
		tkinter.Frame.__init__(self, master)
		self.pack(expand=True, fill="both")
		self.setGUI()

	def setGUI(self):
		inputframe = tkinter.Frame(self)
		inputframe.background = "red" #"#FF0000"
		inputframe.pack(expand=True,fill="x", side="top" )

		self.label1 = tkinter.Label(inputframe)
		self.label1["text"] = "Eingabe"
		self.label1.bd = 10  # border width
		self.label1.fg = "blue" #"#FF0000"  # foreground
		self.label1.bg = "#FF0000"   # backcolor
		self.label1.pack(side="left")
	
		self.spinbox = tkinter.Spinbox(inputframe)
		self.spinbox.activebackground = "blue"
		self.spinbox.pack(expand=True,fill="x",padx="5",pady="5")
		self.spinbox.config(values = ("AI","VW","W"))
		
		self.var_spinbox = tkinter.StringVar()
		self.var_spinbox.set("AI")
		self.spinbox["textvariable"] = self.var_spinbox

		buttonframe = tkinter.Frame(self)
		buttonframe.pack(expand=True,fill="x", side="top" )

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

		self.bnAction = tkinter.Button(buttonframe)
		self.bnAction["text"] = "Action"
		self.bnAction["command"] = self.onAction
		self.bnAction.pack(side="right",padx="5")

	def onAction(self):
		strValue = self.var_spinbox.get()
		messagebox.showinfo( "Hello Python", strValue)




root = tkinter.Tk()
root.title("Spinbox 3")
root.geometry("250x100")
app = MyApp(root)
app.mainloop()



Scrollbar
Text (Multiline Editor)