Die kann ich dann auch nur noch untereinander zeigen.
beispiel mit und ohne Radiobuttons..
ohne:
Code: Alles auswählen
import Tkinter as tk
class hauptprogramm():
def __init__(self,root):
#bestimmung von root
self.root = root
Programmbreite = 1000
Programmhoehe = 700
ProgrammX_Position = 100
ProgrammY_Position = 100
root.geometry('%dx%d+%d+%d' % (Programmbreite,
Programmhoehe,
ProgrammX_Position,
ProgrammY_Position))
Programmname = 'Notationsprogramm'
root.maxsize(Programmbreite, Programmhoehe)
root.title(Programmname)
x= tk.Frame(width=800,height=800,relief=tk.RAISED,background="yellow")
w=xD(x)
x.pack()
class xD(tk.Canvas):
def __init__(self,master):
xpos=0
ypos=0
width=600
height=600
tk.Canvas.__init__(self,master,
border = 4,
relief = 'ridge',
background = 'White'
)
self.place(x=xpos,y=ypos,width=width,height=height)
self.bind("<a>", self.key)
self.bind("<Button-1>", self.callback)
def key(self,event):
self.focus_set()
print "pressed"
def callback(self,event):
self.focus_set()
print "clicked at", event.x, event.y
root = tk.Tk()
x = hauptprogramm(root)
root.mainloop()
Code: Alles auswählen
import Tkinter as tk
class hauptprogramm():
def __init__(self,root):
#bestimmung von root
self.root = root
Programmbreite = 1000
Programmhoehe = 700
ProgrammX_Position = 100
ProgrammY_Position = 100
root.geometry('%dx%d+%d+%d' % (Programmbreite,
Programmhoehe,
ProgrammX_Position,
ProgrammY_Position))
Programmname = 'Notationsprogramm'
root.maxsize(Programmbreite, Programmhoehe)
root.title(Programmname)
x= tk.Frame(width=800,height=800,relief=tk.RAISED,background="yellow")
w=xD(x)
# Optionen fuer die Radiobutton der vorzeichenauswahl
radio_opt_V = options = {}
# statt den Kreisen mit dem Punkt zum auswaehlen der abgesenkte Button
options['indicatoron'] = False
options['width'] = 73
options['selectcolor'] = 'pink'
self.vvv = tk.IntVar()
self.b_vorzeichen = tk.Radiobutton(x,text="Hallo",variable = self.vvv, value = 1, **radio_opt_V)
self.b_vorzeichen.pack(anchor = tk.W)
self.kein_vorzeichen = tk.Radiobutton(x,text="Halloelei",variable = self.vvv, value = 2, **radio_opt_V)
self.kein_vorzeichen.pack(anchor = tk.W)
self.kreuz_vorzeichen = tk.Radiobutton(x,text="Hallleee",variable = self.vvv, value = 3, **radio_opt_V)
self.kreuz_vorzeichen.pack(anchor = tk.W)
x.pack()
class xD(tk.Canvas):
def __init__(self,master):
xpos=0
ypos=0
width=600
height=600
tk.Canvas.__init__(self,master,
border = 4,
relief = 'ridge',
background = 'White'
)
self.place(x=xpos,y=ypos,width=width,height=height)
self.bind("<a>", self.key)
self.bind("<Button-1>", self.callback)
def key(self,event):
self.focus_set()
print "pressed"
def callback(self,event):
self.focus_set()
print "clicked at", event.x, event.y
root = tk.Tk()
x = hauptprogramm(root)
root.mainloop()