@Sirius3: Was hast Du dagegen, wenn ich das so nenne? Ich will deutlich machen, dass es sich dabei nicht um eine normale config Option handelt, sondern um etwas anderes. Es geht nämlich darum, was exportiert wird.
Hier und daher auch im dazugehörigen Eingabefeld im GuiDesigner heißt es '
call Code(self)'
Code: Alles auswählen
LabelFrame('labelframe',**{'myclass': 'FrameWithCode', 'width': 150, 'call Code(self)': 'code.CodeForFrameWithCode', 'height': 150, 'text': 'Frame with Code'})
goIn()
Button('button',**{'call Code(self)': 'code.CodeForMyButton', 'myclass': 'MyButton', 'text': 'button'}).place(y='34', x='29')
goOut()
widget('labelframe').pack()
Und exportiert wird es als:
Code: Alles auswählen
try:
import tkinter as tk
except ImportError:
import Tkinter as tk
#import DynTkInter as tk # for GuiDesigner
# Application definition ============================
class Application(tk.Tk):
def __init__(self,**kwargs):
tk.Tk.__init__(self,**kwargs)
# widget definitions ===================================
self.labelframe = FrameWithCode(self,name='#0_labelframe',text='Frame with Code', width=150, height=150)
self.labelframe.pack()
class FrameWithCode(tk.LabelFrame):
def __init__(self,master,**kwargs):
tk.LabelFrame.__init__(self,master,**kwargs)
self.myclass = 'FrameWithCode'
self.call_code = 'code.CodeForFrameWithCode'
# widget definitions ===================================
self.button = MyButton(self,name='#1_button',text='button')
self.button.place(x='29', y='34')
# call Code ===================================
code.CodeForFrameWithCode(self)
class MyButton(tk.Button):
def __init__(self,master,**kwargs):
tk.Button.__init__(self,master,**kwargs)
self.myclass = 'MyButton'
self.call_code = 'code.CodeForMyButton'
# call Code ===================================
code.CodeForMyButton(self)
#Application().mainloop('guidesigner/Guidesigner.py') # for GuiDesigner
Application().mainloop()
Wenn man dazu noch ein oder auch mehrere Module mit dem dazugehörigen Code importiert, hat man ein lauffähiges Programm!!!