Morgen Leute, ich habe mal ne Frage ob mir jemand bei der Problematik von der Ausrichtung und Arrangement von zwei Listboxen mit V und H Scrollbars weiterhelfen kann mittels Tkinter
Code
import tkinter as tk
# Create the main window
root = tk.Tk()
root.title('CSV Editor')
root.geometry('1280x720')
# Create the listbox
listbox = tk.Listbox(root)
# Create the scrollbar
scrollbarv = tk.Scrollbar(root, orient=tk.VERTICAL)
scrollbarh = tk.Scrollbar(root, orient=tk.HORIZONTAL)
# Link the scrollbar to the listbox
listbox.config(yscrollcommand=scrollbarv.set, xscrollcommand=scrollbarh.set)
scrollbarv.config(command=listbox.yview)
scrollbarh.config(command=listbox.xview)
#Displayorientation listbox1 and scrollbar
scrollbarh.pack(side=tk.BOTTOM, fill=tk.X, padx=10, pady=10)
listbox.pack(side=tk.TOP, padx=10, pady=10,fill=tk.BOTH,expand=True)
scrollbarv.pack(side=tk.RIGHT, fill=tk.Y, padx=10, pady=10)
# Create the listbox2
listbox2 = tk.Listbox(root)
# Create the scrollbar2.v
scrollbar2v = tk.Scrollbar(root, orient=tk.VERTICAL)
scrollbar2h = tk.Scrollbar(root, orient=tk.HORIZONTAL)
# Link the scrollbar to the listbox2
listbox2.config(yscrollcommand=scrollbar2v.set, xscrollcommand=scrollbar2h.set)
scrollbar2v.config(command=listbox2.yview)
scrollbar2h.config(command=listbox2.xview)
#Displayorientation listbox2 and scrollbar
scrollbar2h.pack(side=tk.BOTTOM, fill=tk.X, padx=10, pady=10)
listbox2.pack(side=tk.LEFT, padx=10, pady=10,fill=tk.BOTH,expand=True)
scrollbar2v.pack(side=tk.RIGHT, fill=tk.Y, padx=10, pady=10)
# Start the main loop
root.mainloop()
Alles anzeigen
Das ist der Code dazu nur leider werden die Listboxen inkl. Scrollbars nicht untereinander gestellt sondern geschachtelt.
forum.linuxguides.de/core/index.php?attachment/5684/
Stehe als Einsteiger mit Brett vorm Kopf ziemlich an, denn wie auch immer ich TOP/LEFT/RIGHT/BOTTOM anwende, sie stehen nicht untereinander.
LG