DMarlon Studio

Basic tkinter course

From scratch: everything you need to write your first programs. In DMarlon Studio, tkinter is the Desktop (Python) target: drag components from the palette onto the form, set their properties in the inspector and the studio writes this same tkinter code.

Start
  1. 1Your first windowCreate a desktop window with Python and tkinter: Tk(), title, size and mainloop(). The same window DMarlon Studio designs in Desktop (Python).Lesson 1
  2. 2Labels: text and coloursShow text in a tkinter window with Label: font, colours, alignment with anchor and line breaks with wraplength.Lesson 2
  3. 3Buttons and their actionA tkinter button with command: every click calls a function that updates a counter. Plus disabled buttons with state.Lesson 3
  4. 4Text fields with StringVarThe tkinter text field (Entry) bound to a StringVar: an initial value, reading it with get() and a label that changes as you type.Lesson 4
  5. 5Password fieldsHide what is typed in a tkinter Entry with show="•" and add a button that shows or hides the password.Lesson 5
  6. 6Multi-line textThe tkinter Text widget: several lines, word wrapping, tags for bold and colours, and positions written as line.column.Lesson 6
  7. 7Checkboxestkinter checkboxes (Checkbutton), each with its own BooleanVar: some checked at the start and a summary that changes on every click.Lesson 7
  8. 8Radio buttonsA group of tkinter Radiobuttons: one StringVar for the whole group, one option chosen at the start and a price that follows it.Lesson 8
  9. 9Lists of itemsThe tkinter Listbox: adding items, leaving one or more selected with selection_set, selectmode, and reading the selection with curselection().Lesson 9
  10. 10Drop-down listsThe ttk Combobox: a list of values, the initial value with current() or set(), read-only mode and the <<ComboboxSelected>> event.Lesson 10
  11. 11SlidersPick numbers by dragging with tkinter's Scale: horizontal and vertical, with a title, range, step and visible value, plus ttk.Scale.Lesson 11
  12. 12Spinbox: values with arrowstkinter's ttk.Spinbox: numbers with from_, to and increment, a fixed list of values with wrap, and decimals with format.Lesson 12
  13. 13Frames for groupingGroup a tkinter form with Frame and LabelFrame: titled sections, rows of label and field, and a bar of buttons.Lesson 13
  14. 14Layout with packtkinter's pack manager: side, fill and expand to build a header, a toolbar, side panels and a central area that grows.Lesson 14
  15. 15Layout with gridtkinter's grid manager: rows, columns, sticky, columnspan and weights for a form that adapts to the size of the window.Lesson 15
  16. 16Layout with placetkinter's place manager: absolute positions in pixels, positions relative to the window's size, and anchor. It is the one DMarlon Studio uses.Lesson 16
  17. 17ScrollbarsA ttk.Scrollbar connected to a tkinter Listbox and Text: yview, xview and yscrollcommand, both vertical and horizontal.Lesson 17
  18. 18Separator, Message and SizegripThree small tkinter widgets: ttk.Separator to divide, tk.Message for text that wraps by itself and ttk.Sizegrip to resize.Lesson 18
  19. 19ttk styles and themesChange how ttk widgets look with ttk.Style: themes, configure() for a style, custom styles such as Accent.TButton, and map().Lesson 19
  20. 20Project: a registration formA registration form with tkinter and grid: entries, a password, a drop-down list, options, a checkbox and a button that checks the data.Lesson 20