|
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()
|
|