Python 3.3 Tkinter Labelframe Resizable
Is it possible to create a resizable LabelFrame? Or any way? And is it possible to use ttk.PanedWindow with LabelFrame for this? it's my code: fram1 = ttk.LabelFrame(root, text =
Solution 1:
The panedwindow can hold any single widget in a pane so a labelframe is no problem and allows you to add further widgets and children of the labelframe. An example:
import sys
from tkinter import *
from tkinter.ttk import *
def main():
app = Tk()
pw = PanedWindow(app, orient='vertical')
paneA = LabelFrame(pw, text="Pane A", height=240, width=320)
paneB = LabelFrame(pw, text="Pane B", height=240, width=320)
pw.add(paneA, weight=50)
pw.add(paneB, weight=50)
pw.pack(fill='both', expand=True)
app.mainloop()
if __name__=='__main__':
sys.exit(main())
The weight allows you to set a proportionate scaling for each pane as you change the size of the container. If both panes have the same weight then they grow by the same amount.
Post a Comment for "Python 3.3 Tkinter Labelframe Resizable"