Re: Workshop: Gui Entwicklung in tkinter
Verfasst: Mittwoch 14. Juni 2017, 18:35
Das wäre dann ein sichtbares Beispiel für Deine InputGUI. Natürlich toggelt da jetzt nichts.
AppInput.py
Für die OutputGUI hast Du kein eigenes Modul spendiert. Warum nicht, machen wir es doch schön symmetrisch.
Dann ist das:
AppOutput.py
AppInput.py
Code: Alles auswählen
# -*- coding: utf-8 -*-
try:
import tkinter as tk
except ImportError:
import Tkinter as tk
#import DynTkInter as tk # for GuiDesigner
#============= imports call Code ===================
import testcode
# Application definition ============================
class Application(tk.Tk):
def __init__(self,**kwargs):
tk.Tk.__init__(self,**kwargs)
self.minsize(300, 300)
# widget definitions ===================================
self.InputContentGUI = InputGUI(self,name='#0_InputContentGUI')
self.InputContentGUI.pack(expand=1, fill='both')
class InputGUI(tk.Frame):
def __init__(self,master,**kwargs):
tk.Frame.__init__(self,master,**kwargs)
self.myclass = 'InputGUI'
self.call_code = 'testcode.InputCode'
self.config(relief='solid', bd=4)
# widget definitions ===================================
self.sub_frameA = tk.Frame(self,name='#1_sub_frameA',height=40, bg='#ffffd3')
self.sub_frameB = tk.Frame(self,name='#2_sub_frameB',height=40, bg='#e4f3fc')
self.sub_frameC = tk.Frame(self,name='#3_sub_frameC',relief='sunken', width=50, bg='#cbeed8')
self.sub_frameA.pack(fill='x')
self.sub_frameB.pack(fill='x')
self.sub_frameC.pack(expand=1, fill='both', side='left')
# call Code ===================================
testcode.InputCode(self)
if __name__ == '__main__':
#Application().mainloop('guidesigner/Guidesigner.py') # for GuiDesigner
Application().mainloop()
Dann ist das:
AppOutput.py
Code: Alles auswählen
# -*- coding: utf-8 -*-
try:
import tkinter as tk
except ImportError:
import Tkinter as tk
#import DynTkInter as tk # for GuiDesigner
#============= imports call Code ===================
import testcode
# Application definition ============================
class Application(tk.Tk):
def __init__(self,**kwargs):
tk.Tk.__init__(self,**kwargs)
self.minsize(400, 400)
# widget definitions ===================================
self.OutputContentGUI = OutputGUI(self,name='#0_OutputContentGUI')
self.OutputContentGUI.pack(fill='both', expand=1)
class OutputGUI(tk.Frame):
def __init__(self,master,**kwargs):
tk.Frame.__init__(self,master,**kwargs)
self.myclass = 'OutputGUI'
self.call_code = 'testcode.OutputCode'
self.config(bd=4, bg='#ffeb00', relief='solid')
# call Code ===================================
testcode.OutputCode(self)
if __name__ == '__main__':
#Application().mainloop('guidesigner/Guidesigner.py') # for GuiDesigner
Application().mainloop()