11월, 2023의 게시물 표시

Python - ttkbootstrap widgets layout #3 grid

이미지
 A grid is the easiest way to place complex widget layouts. Like the Excel we commonly use, widgets can be placed using row and column numbers. The following is a simple example of arranging a widget using two rows and two columns. import ttkbootstrap as tb app = tb . Window() app . style . theme_use( "superhero" ) app . geometry( "750x450" ) frame = tb . Frame(app, bootstyle = "primary" , width = 100 , height = 100 ) frame . grid(column = 0 , row = 0 ) frame2 = tb . Frame(app, bootstyle = "warning" , width = 100 , height = 100 ) frame2 . grid(column = 1 , row = 0 ) app . mainloop() <basic_grid.py> def grid ( cnf: Mapping[str, Any] | None = {}, * , column: int = ... , columnspan: int = ... , row: int = ... , rowspan: int = ... , ipadx: _ScreenUnits = ... , ipady: _ScreenUnits = ... , padx: _ScreenUnits | tuple[_ScreenUnits, _ScreenU...

Python - ttkbootstrap widgets layout #2 place

이미지
place allows you to position a widget by specifying exact location coordinates. Absolute coordinates (x, y) can be used, and a relative ratio to the parent window size (relx, rely) can also be used. import ttkbootstrap as tb app = tb . Window() app . style . theme_use( "superhero" ) app . geometry( "750x450" ) frame = tb . Frame ( app , bootstyle = "primary" , width = 100 , height = 100 ) frame . place ( x = 100 , y = 100 ) frame2 = tb . Frame ( app , bootstyle = "warning" , width = 100 , height = 100 ) frame2 . place ( x = 300 , y = 100 ) app . mainloop() <basic_place.py> def place ( cnf: Mapping[str, Any] | None = {}, * , anchor: _Anchor = ... , bordermode: Literal[ 'inside' , 'outside' , 'ignore' ] = ... , width: _ScreenUnits = ... , height: _ScreenUnits = ... , x: _ScreenUnits = ... , y: _ScreenUnits = ... , relhei...

Python - ttkbootstrap widgets layout #1 pack

이미지
ttkbootstrap is a Python package that provides a theme extension for tkinter. It enables on-demand modern flat style themes inspired by Bootstrap1. The package comes with a built-in theme creator that allows you to easily build, load, explore, and apply your own custom themes1. Some of the features of ttkbootstrap include: Over a dozen curated dark and light themes. Loads of beautiful pre-defined widget styles such as outline and round toggle buttons. Simple keyword API: Apply colors and types using simple keywords such as primary and striped instead of the legacy approach of primary.Striped.Horizontal.TProgressbar. If you’ve used Bootstrap for web development, you are already familiar with this approach using css classes. Lots of new Widgets: ttkbootstrap comes with several new beautifully designed widgets such as Meter, DateEntry, and Floodgauge. Additionally, dialogs are now themed and fully customizable1. However, Tkinter and ttkbootstrap do not provide a separate GUI tool to speci...