2 @package libtextworker.interface.tk.actionrow
3 ActionRow class for Tkinter.
4 ActionRow is a vertical (layout) tkinter.Frame that is used for a specific action.
5 Useful for creating Settings pages.
18 Inspired from libadwaita's ActionRow class,
19 tkActionRow is a vertical (layout) tkinter.Frame with
20 text on one side, and everything else like buttons on the other side.
26 def PlaceObj(this, obj: tkinter.Misc, column: int | str = -1,
27 sticky: str =
"e", *args, **kwds):
29 Place a widget using grid method.
30 @param obj (tkinter.Misc): What widget to place (class/function reference, NOT an instance)
31 @param column (int): Where to place (row is always 0). -1 will place the widget next to the last one.
32 @param sticky (str): Sticky option
33 @param args, kwds: Options for the widget to place
44 target = obj(*args, **kwds)
45 target.grid(column=column
if column > -1
else this._curr_col + 1, row=0, sticky=sticky)
50 expand: bool =
True, fill: str =
"x",
53 Place a widget using pack method.
54 @param obj (tkinter.Misc): What widget to place (class/function reference, NOT an instance)
55 @param side, expand, fill: Pack options
56 @param args, kwds: Options for the widget to place
67 target = obj(*args, **kwds)
68 target.pack(expand=expand, fill=fill, side=side)
71 if __name__ ==
"__main__":
75 row.PlaceObjPack(tkinter.Label, text=
"Hello world!", side=
"left")
76 row.PlaceObjPack(tkinter.ttk.Button, text=
"This was placed using pack() method")
77 row.pack(expand=
False, fill=
"x")
80 row2.PlaceObjPack(tkinter.Label, text=
"Welcome to tkActionRow", side=
"left")
81 row2.PlaceObjPack(tkinter.ttk.Button, text=
"This was placed using pack() method")
82 row2.pack(expand=
False, fill=
"x")
def PlaceObjPack(this, tkinter.Misc obj, str side="right", bool expand=True, str fill="x", *args, **kwds)
def PlaceObj(this, tkinter.Misc obj, int|str column=-1, str sticky="e", *args, **kwds)