-1

I was trying to add a files view in my text editor. Is there any way to resize tkinter frame by either x-axis or y-axis?

example:

enter image description here

like this resizing the files view.

Is there any way to do the same in a tkinter frame?

imxitiz
  • 3,920
  • 3
  • 9
  • 33
  • You can use paned window –  Jul 12 '21 at 11:36
  • Does this answer the question https://stackoverflow.com/questions/54767062/python-tk-inter-using-bind-to-resize-frame-dynamically –  Jul 12 '21 at 11:37

1 Answers1

2

If you mean, you want a splitter widget, you can make use of PanedWindow.

Here is a minimal example:

import tkinter as tk

root = tk.Tk()

splitter = tk.PanedWindow(root, handlesize=2, orient=tk.HORIZONTAL)
splitter.pack(fill='both', expand=True)


leftFrame = tk.Frame(splitter, bg='red')
rightFrame = tk.Frame(splitter, bg='blue')

splitter.add(leftFrame, width=100)
splitter.add(rightFrame)


root.mainloop()

you can now expand the frame by using the handle.

Art
  • 2,836
  • 4
  • 17
  • 34