ich mach gerade die ersten Schritte Python und möchte ttkbootstrap für den Einsatz von Widgets verwenden. Vielleicht hat jemand von euch bereits Erfahrung darin.
Ich für meinen Teil denke, auch wenn ihr euch damit nicht auskennt sollte es ein leichtes sein (für mich leider nicht

Link: https://ttkbootstrap.readthedocs.io/en ... mn_center
Folgende Aufgabe:
1) Beispiel Code für die Erstellung des "TableView-Modul's" mit 3 Spalten und 3 Zeilen
Code: Alles auswählen
import ttkbootstrap as ttk
from ttkbootstrap.tableview import Tableview
from ttkbootstrap.constants import *
app = ttk.Window()
colors = app.style.colors
coldata = [
{"text": "LicenseNumber", "stretch": False},
"CompanyName",
{"text": "UserCount", "stretch": False},
]
rowdata = [
('A123', 'IzzyCo', 12),
('A136', 'Kimdee Inc.', 45),
('A158', 'Farmadding Co.', 36)
]
dt = Tableview(
master=app,
coldata=coldata,
rowdata=rowdata,
paginated=True,
searchable=True,
bootstyle=PRIMARY,
stripecolor=(colors.light, None),
)
dt.pack(fill=BOTH, expand=YES, padx=10, pady=10)
app.mainloop()
2) jetzt möchte ich z.B. die 3te Spalte linksbündig setzen. Der "einfache" Befehl lautet
Code: Alles auswählen
def align_column_left(self, event=None, cid=None):
"""Left align the column text. This can be triggered by
either an event, or by passing in the `cid`, which is the index
of the column relative to the original data set.
Parameters:
event (Event):
An application click event.
cid (int):
A unique column identifier; typically the index of the
column relative to the original dataset.
"""
if event is not None:
eo = self._get_event_objects(event)
self.view.column(eo.column.cid, anchor=W)
elif cid is not None:
self.view.column(cid, anchor=W)
Code: Alles auswählen
def delete(self):
"""Remove the column from the tableview permanently."""
# update the tablerow columns
index = self.tableindex
if index is None:
return
for row in self._table.tablerows:
row.values.pop(index)
row.refresh()
# actual columns
cols = list(self.view.cget("columns"))
cols.remove(self.cid)
self._table.tablecolumns.remove(self)
# visible columns
dcols = list(self.view.cget("displaycolumns"))
if "#all" in dcols:
dcols = cols
else:
dcols.remove(self.cid)
# remove cid mapping
self._table.cidmap.pop(self._cid)
# reconfigure the tableview column and displaycolumns
self.view.configure(columns=cols, displaycolumns=dcols)
# remove the internal object references
for i, column in enumerate(self._table.tablecolumns):
if column.cid == self.cid:
self._table.tablecolumns.pop(i)
else:
column.restore_settings()
Schonmal Vielen Dank
Gruß Dirk