Skip to content

Latest commit

 

History

History
218 lines (176 loc) · 5.41 KB

REFERENCE.md

File metadata and controls

218 lines (176 loc) · 5.41 KB

Declarative Components

Generic PySide6 flet tkinter textual
Application QApplication Page Tk App
Window QMainWindow ✓(Single) Toplevel ✓(Single)
HBox QHBoxLayout Row Frame(grid) Horizontal
VBox QVBoxLayout Column Frame(grid) Vertical
Spacer QSpacerItem
Label QLabel Text Label Label/Button
Button QPushButton ElevatedButton Button Button
Checkbox QCheckBox Checkbox Checkbutton Checkbox
RadioButton QRadioButton Radio Radiobutton RadioButton
Canvas ✓(QWidget) Canvas Canvas -
TextField QLineEdit TextField Entry Input
ProgressBar QProgressBar ProgressBar Progressbar ProgressBar
Scroll QScrollArea ScrollableContainer
Text QLabel Text Label Text
Html QLabel ⚠ Text ⚠ Label ⚠ Text
MarkDown QLabel Markdown ⚠ Label Markdown
Combobox QComboBox - - -
ComboboxItem - - -
Table QTableView - - -
Tabs QTabWidget Tabs Notebook Tabs
Tab Tab
MenuBar QMenuBar - - -
Menu QMenu - - -
MenuAction QAction - - -
MdiArea QMdiArea - - -
MdiSubWindow QMdiSubWindow - - -
Splitter QSplitter - - -
Modal - - -
(Interop) QtInPui - - -
(Interop) PuiInQt - - -

Imperative Dialogs

Generic PySide6 flet tkinter textual
OpenDirectory QFileDialog.getExistingDirectory - - -
OpenFile QFileDialog.getOpenFileName - - -
OpenFiles QFileDialog.getOpenFileNames - - -
SaveFile QFileDialog.getSaveFileName - - -
Information QMessageBox - - -
Warning QMessageBox - - -
Critical QMessageBox - - -
Confirm QMessageBox - - -
Prompt QInputDialog - - -

Declarative Components

Common Modifiers

  • .layout(width=320, height=240, weight=1, padding=, margin=)
  • .style(color=0xFF0000, bgColor=0x0, fontSize=16, fontWeight="bold", fontFamily="Arial")
  • .qt(HorizontalPolicy=, VerticalPolicy=, SizeConstraint=, StyleSheet={})
  • .flet(k=v)

Application

Top level element of an application

Application()

Window

flet and textual backends only support single window

Window([title=str][,size=(w,h)][,maximize=bool][,fullscreen=bool])

Modal

Modal window

Example

Modal(model[,offValue=None][,title=str][,size=(w,h)][,maximize=bool][,fullscreen=bool])

HBox

Horizontal Linear Layout Container

Example

HBox()

VBox

Vertical Linear Layout Container

Example

VBox()

Spacer

Spacer inside linear layout containers

Example

with HBox():
    Text("Left")
    Spacer()
    Text("Right")

Scroll

Scrollable container

Example

with Scroll().layout(weight=1).scrollY(Scroll.END):
    with VBox():
        for i in range(100):
            Label(f"Row {i+1}")

Button

Single line clickable text with button appearance

Example

Button(text).click(callback, *cb_args, **cb_kwargs)

Label

Single line clickable text

Example

Label(text).click(callback, *cb_args, **cb_kwargs)

Text

Multiple line text viewer

Example

Text(text)

Html

HTML viewer (only supported by PySide6 backend)

Example

Html(html)

Markdown

Markdown viewer (not supported by tkinter backend)

Example

Markdown(md)

TextField

Single line text editor

Example

TextField(binding)

ProgressBar

Linear progress indicator

Example

ProgressBar(progress `0-1`)

Checkbox

Example

Checkbox(label, model)

RadioButton

Example

RadioButton(label, value, model)

Canvas

Example

def painter(canvas):
    canvas.drawText(x, y, text)
    canvas.drawLine(x1, y1, x2, y2, color=0xFF0000, width=2)
    canvas.drawPolyline([x1, y2, ..., xn, yn], color=0xFF0000, width=2)

Canvas(painter)

Tabs and Tab

Example

Table

Table widget

Example

Table(adapter)

Interop

QtInPui

Wrapper for embedding native widget instance into PUI

Currently only supported by PySide6 backend

Example

PuiInQt

Wrapper for embedding PUI view into existing QT view hierarchy

Currently only supported by PySide6 backend

Example