Apr-26-2020, 04:20 AM
I'm playing around with building a generic frame and I was wondering if there was a way to see the structure in shell. To see if the widgets are going in the frames. This is what I'm seeing when printing.
Thanks
Thanks
#! /usr/bin/env python3.8 '''Docstring''' import tkinter as tk from tkinter import ttk class RootWindow: '''Docstring''' #pylint: disable=R0903 def __init__(self, master): print('RootWindow init') self.master = master self.master.columnconfigure(0, weight=1) self.master.rowconfigure(0, weight=1) bbb = FrameBuild(self.master).frame_skeleton(self.master) BuildHeader(master='logo_frame').header(bbb) class FrameBuild: '''Docstring''' #pylint: disable=R0903 def __init__(self, master): pass def frame_skeleton(self, master, colspan=1, column=0, row=0, sticky='news'): '''Frames''' #pylint: disable=R0201, R0913 print('I am builder') frame = ttk.Frame(master) frame.grid(columnspan=colspan, column=column, row=row, sticky=sticky) return frame class BuildHeader: '''Header''' #pylint: disable=R0903 def __init__(self, master): pass def header(self, master, column=0, row=0, sticky='news'): '''Docstring''' #pylint: disable=R0201 print('I am header') logo = ttk.Label(master, text='I am a label') logo.grid(column=column, row=row, sticky=sticky) print(logo) return logo def main(): '''Docstring''' root = tk.Tk() RootWindow(root) root.mainloop() if __name__ == '__main__': main()
Output:RootWindow init
I am builder
I am header
.!frame.!label