RhetTbull / guitk

Python GUI Toolkit for Tk (guitk): simplify the layout and construction of tkinter graphical user interfaces in python using a declarative syntax.
MIT License
18 stars 1 forks source link

Add autoframe=True to Window, Frame #4

Closed RhetTbull closed 3 years ago

RhetTbull commented 3 years ago

The current implementation of guitk requires too much use of guitk.Frame() to make layouts work when there are different numbers of columns in each row. In PySimpleGUI, this “just works”.

Add an autoframe=True keyword arg to Window and Frame/LabelFrame that defaults to True. If True and there's more than one element in a row, will wrap each row in a Frame. There may be times user will want to adjust things manually so adding this as a kw arg allows it to be turned off if necessary.

RhetTbull commented 3 years ago

In this section of _layout (add autoframe to _layout args)

         col_offset = 0 
         if autoframe and len(row) > 1:
             row_ = Frame(layout=[row], other args)
         else:
             row_ = row
         for col_count, widget in enumerate(row_): 

https://github.com/RhetTbull/guitk/blob/3ae4c443ea8d4ec516ad1299796671144e9beadf/guitk/__init__.py#L101-L106