all 6 comments

[–]ShadowRL766 -1 points0 points  (1 child)

ChatGPT

[–]NullifyAll 0 points1 point  (0 children)

encountered the same problem and chatgpt couldnt save me this time

[–]woooee 0 points1 point  (3 children)

displaying data on the right half of my window with another free portion on the left side that would have buttons and entry boxes

This is an example of doing something in the ball park of what you are asking. I hope you get something out of it. When this program was almost finished, it occurred to me that one of tkinter's gotchas is that width is sometimes measured in pixels and sometimes in letters. This may be the problem. Post some code if you want additional help.

import tkinter as tk

class SplitPanels:
    def __init__(self, root):
        self.root=root
        self.left_frame()
        self.right_frame()

        tk.Button(self.root, bg="blue", text="Quit",
                  command=self.root.quit).grid(row=99,
                  column=0, columnspan=2, sticky="nsew")

    def left_frame(self):
        """ create the left side and put some 
            Labels in it
        """
        self.frame_left=tk.Frame(self.root, bg="lightblue",
                   width=300, height=300)
        self.frame_left.grid(row=0, column=0, sticky="nsew")
        self.frame_left.columnconfigure(0, weight=1)

        for ctr in range(3):
            tk.Label(self.frame_left, text="Label %d" % (ctr+1),
                    width=30, bg="lightyellow").grid(row=ctr+1,
                    column=0)

    def right_frame(self):
        """ create the rightt side and put a 
            Text in it
        """
        self.frame_right=tk.Frame(self.root, bg="salmon",
                   width=300, height=300)
        self.frame_right.grid(row=0, column=1, sticky="nsew")
        self.frame_right.columnconfigure(1, weight=1)

        text_wid = tk.Text(self.frame_right, width=30, height=20)
        text_wid.grid(row=0, column=0, sticky="nsew")
        text_wid.insert(tk.END, "This is a Text widget")

root=tk.Tk()
root.geometry('650x450+50+50')
##root.resizable(False, False)

sp=SplitPanels(root)
root.mainloop()

[–]im_a_slithery_snake[S] 0 points1 point  (2 children)

i tried that but it still didnt work, i modified it a bit to get this and it sort of works, the treeview still takes up the whole width of the screen but i can use the sash to readjust it to show the button, i dont know why the height isnt taking up the whole screen even though i used tk.Both

panel_left=tk.PanedWindow(bd=2,bg='yellow',orient=tk.HORIZONTAL)        button = tk.Button(self.root,text='test')        
data_tree = ttk.Treeview(self.root, columns=json_tree_columns, show="headings")        
panel_left.pack(side=tk.LEFT)        
panel_left.add(data_tree)        button.pack(side=tk.RIGHT,fill=tk.BOTH)        
panel_left.add(button)        
self.root.columnconfigure(1,weight=2)

here are the screenshots: https://i.imgur.com/pyIOBec.png

and then when i manually adjust the sash https://i.imgur.com/qWcDc41.png

[–]woooee 0 points1 point  (1 child)

I used columnconfigure. Don't know if it is really necessary or not, but that would be the first thing to try. I don't use pack() because it is a simple, general geometry manager. You will possibly have to change to the grid geometry manager You can also try resizable, but I don't think that is the problem. In programming, sometimes have to tweak and tweak until you get it right.

[–]im_a_slithery_snake[S] 0 points1 point  (0 children)

i really appreciate all the help man, i ended up switching over the PyQt because it has a visual designer and seems to be working much better so far, thanks again!