Für mich stellt sich die Frage, wie ich die Angabe
Code: Alles auswählen
self.root.winfo_screenwidth()
Beispiel:
Bei mir erhalte ich als Wert von
Code: Alles auswählen
self.root.winfo_screenwidth()
Das Fenster teile ich in einen linken und rechten Frame, mit jeweils 'width="18"' und einem Frame in der Mitte mit 'width="200"' auf. Der Rest wird dann durch 'fill="both"' erledigt.
Code: Alles auswählen
#!/usr/bin/python3
import tkinter as tk
class View(object):
def __init__(self, controller):
self.root = tk.Tk()
self.root.title('Titel')
self.controller = controller
xpos = 0
ypos = 0
screenx = self.root.winfo_screenwidth()
print(screenx)
screeny = self.root.winfo_screenheight()
self.root.geometry("%dx%d+%d+%d" % (screenx, screeny, xpos, ypos))
self.frame = tk.Frame(self.root)
self.frame.pack(side='top', fill='both', expand=True)
# Frame links
button_frame_left = tk.Label(self.frame, width=18, height=screeny,
bg='green')
button_frame_left.pack(side='left', fill='both')
# Frame rechts
button_frame_right = tk.Label(self.frame, width=18, height=screeny,
bg='darkgreen')
button_frame_right.pack(side='right', fill='both')
# Frame für Textfenster
self.winLabel = tk.Label(self.frame, width=200,
bg='yellow', fg='brown', text='Text',
font=('NimbusSansL', 14))
self.winLabel.pack(anchor='n', expand='YES', fill='both')
# Frame unten
label_down = tk.Label(self.frame, heigh=8, width=200,
bg='blue')
label_down.pack(anchor='s', fill='x')
def run(self):
self.frame.mainloop()
class Controller(object):
def __init__(self):
self.view = View(self)
def process_select_data(self):
pass
def run(self):
self.view.run()
def main():
Controller().run()
if __name__ == '__main__':
main()
Grüße Nobuddy