ich versuche bei meinem Programm ein DropDown Menü zu schreiben um die Rechenart auszuwählen. Der folgende Code funktionier einwandfrei.
Code: Alles auswählen
import tkinter as tk
class View(tk.Tk):
def __init__(self):
tk.Tk.__init__(self)
L = ["+","-","*","/"]
self.vS = tk.StringVar(master=self)
self.vS.set("Rechenart")
self.oS = tk.OptionMenu(self,self.vS,*L, command=self.cbOption)
self.oS.pack()
def cbOption(self,wert):
print(wert)
v = View()
v.mainloop()
Code: Alles auswählen
from Tkinter import *
from funktionen import *
root = Tk()
z1 = Entry(root)
z1.grid(row=0,column=0,padx=10,pady=10)
n1 = Entry(root)
n1.grid(row=2,column=0,padx=10,pady=10)
z2 = Entry(root)
z2.grid(row=0,column=2,padx=10,pady=10)
n2 = Entry(root)
n2.grid(row=2,column=2,padx=10,pady=10)
strich0=Label(root,text="-----------------------")
strich2=Label(root,text="-----------------------")
strich4=Label(root,text="-----------------------")
strich0.grid(row=1,column=0,padx=10,pady=10)
strich2.grid(row=1,column=2,padx=10,pady=10)
strich4.grid(row=1,column=4,padx=10,pady=10)
root.mainloop()
Code: Alles auswählen
import Tkinter as tk
LG Schweden1997