I try to create such a scrollbar for my g program and I cannot start the Python geometry service (G means GUI Graphical User Interface).
At least this is how Google Translate translates this error.
import os from tkinter import * MyGUIinterface = Tk() folderpathget = StringVar() MyGUIinterface.title("LSTIR Pratotype") MyGUIinterface.geometry('600x500') txt = Entry(MyGUIinterface, textvariable = folderpathget ,width=50) txt.grid(column=2, row=0) def clicked(): folderpathget_string =os.listdir(folderpathget.get()) i = 0 stringconvert = '' while i < len(folderpathget_string): stringconvert += folderpathget_string[i] + "\n" i += 1 folderpath = Message(MyGUIinterface, text=stringconvert) folderpath.grid(columnspan=1) #scroll bar scrollbar = Scrollbar(MyGUIinterface) scrollbar.pack( side = RIGHT, fill = Y ) mylist = Listbox(MyGUIinterface, yscrollcommand = scrollbar.set ) for line in range(100): mylist.insert(END) mylist.pack( side = LEFT, fill = BOTH ) scrollbar.config( command = mylist.yview ) btn = Button(MyGUIinterface, text="enter the folder path and click me", command = clicked ) btn.grid(column = 0, row=0) MyGUIinterface.mainloop() Mistake:
Traceback (most recent call last): File "test.py", line 34, in <module> scrollbar.pack( side = RIGHT, fill = Y ) File "/usr/lib64/python3.6/tkinter/__init__.py", line 2140, in pack_configure + self._options(cnf, kw)) _tkinter.TclError: cannot use geometry manager pack inside . which already has slaves managed by grid