FontDialog
FontDialog is a modal font picker that lets users choose a font family, size, and style, then confirm or cancel.
Use it for editor-like features (rich text, labels, code editors) where users need a standard font selection experience.
Quick start
import bootstack as bs
app = bs.App()
dlg = bs.FontDialog(title="Choose a font")
result = dlg.show()
print("font:", result) # font string/object or None
app.mainloop()
When to use
Use FontDialog when:
-
font choice is part of a user customization workflow
-
you want a standard modal picker
Consider a different control when...
- font selection is a frequent, always-visible control (toolbars) - use inline font controls instead
Examples & patterns
Common options
-
title- dialog title -
initial_font(if supported) -
preview sample text (if supported)
Value model
Font dialogs typically return:
-
a committed font spec (string, tuple, or object), or
-
Nonewhen cancelled
Behavior
-
OK commits the selected font
-
Cancel closes without committing
-
Enter confirms, Escape cancels (typical)
Additional resources
Related widgets
-
Dialog - base dialog API
-
FormDialog - structured multi-field input
-
MessageBox - confirmations/alerts