0 Replies - 376 Views - Last Post: 01 April 2021 - 03:52 PM Rate Topic: -----

#1 rfresh   User is offline

  • D.I.C Head

Reputation: -1
  • View blog
  • Posts: 149
  • Joined: 23-August 12

PanedWindow Sash Attributes and Style

Posted 01 April 2021 - 03:52 PM

I'm having trouble getting and setting the sash of my panedwindow widget.

My understanding is that I can read the current sash position so I can restore it upon the next start up. My main goal is to be able to read the current sash pos so I can restore it from a file. I can do the file part OK. I just can't seem to read the pos value and set a different value using sashpos(0,n).

I have print(panedwindow.sashpos(0)) which returns 0 but I'm not sure what that means?

When I create my panedwindow, if I try to use the sashrelief and sashpad attributes I get errors.

Also I'd like to style the sash (like sashthickness) but I can't get any of the style attributes to work without giving errors.

Thank you for any help.

# Create app using with separating widget
from tkinter import *
from tkinter import ttk
import os

root = Tk()
root.title("Test")
root.geometry('800x500-300+350')


# https://anzeljg.github.io/rin2/book2/2405/docs/tkinter/panedwindow.html
panedwindow = ttk.Panedwindow(root, orient=HORIZONTAL, showhandle=TRUE, sashrelief=FLAT, sashpad=20)

panedwindow.pack(fill=BOTH, expand=True)

frame1 = ttk.Frame(panedwindow, relief=GROOVE, padding=5)
frame2 = ttk.Frame(panedwindow, relief=GROOVE, padding=5)

panedwindow.add(frame1, weight=1)
panedwindow.add(frame2, weight=4)

#print(panedwindow.sashpos(0))
#panedwindow.sashpos(0,70)

root.mainloop()



Is This A Good Question/Topic? 0
  • +

Page 1 of 1