Slide 1

Slide 1 text

GUI programming on Python with tkinter no­title.victordomingos.com

Slide 2

Slide 2 text

What is tkinter? "Tkinter is Python's de­facto standard GUI (Graphical User Interface) package. It is a thin object­oriented layer on top of Tcl/Tk."

Slide 3

Slide 3 text

Tkinter examples you may have seen...

Slide 4

Slide 4 text

Tkinter examples you may have seen...

Slide 5

Slide 5 text

With ttk, you get a nicer look.

Slide 6

Slide 6 text

Themed widgets can match the platform.

Slide 7

Slide 7 text

And it can grow, if you need it.

Slide 8

Slide 8 text

The boilerplate:

Slide 9

Slide 9 text

• Text • Scale • Scrollbar • Spinbox • Progressbar • Treeview • Separator Available widgets (incl. ttk) • Label • Entry • Button • Checkbutton • Menubutton • Radiobutton • Combobox • Toplevel (+windows) • Frame • LabelFrame • PanedWindow • Notebook • Sizegrip • Canvas

Slide 10

Slide 10 text

...and some more in these modules • tkinter.scrolledtext • tkinter.colorchooser • tkinter.filedialog • tkinter.messagebox • turtle

Slide 11

Slide 11 text

Let’s see it in action!

Slide 12

Slide 12 text

So, should I use tkinter?

Slide 13

Slide 13 text

PROS • It’s simple to learn. • Bundled with Python. • Highly portable. • Can look [kind of] native. • It’s fast enough. • Mature and stable. • Free for commercial use. So, should I use tkinter?

Slide 14

Slide 14 text

PROS • It’s simple to learn. • Bundled with Python. • Highly portable. • Can look [kind of] native. • It’s fast enough. • Mature and stable. • Free for commercial use. CONS • Limited widget set (e.g. no date picker, no webview). • No UI designer. • Doesn’t look totally native. • It’s not as fast as a native Swift or C++ GUI. • Usually, no new features. So, should I use tkinter?

Slide 15

Slide 15 text

• https://docs.python.org/3/library/tk.html • https://tkdocs.com • http://effbot.org/tkinterbook/tkinter­index.htm • http://infohost.nmt.edu/tcc/help/pubs/tkinter/tkinter.pdf If you speak Tcl, explore Tcl/tk docs too. More info:

Slide 16

Slide 16 text

Tkinter GUI Aplication Development Blueprints Bhaskar Chaudhary Packt Publishing, 2015 Useful books: Python GUI Programming Cookbook Burkhard A. Meier Packt Publishing, 2017

Slide 17

Slide 17 text

• https://stackoverflow.com/questions/tagged/tkinter Sooner or later, you will probably find, on StackOverflow, some insightful answers from a guy named Brian Oakley. You definitely should trust him. In case you get stuck...

Slide 18

Slide 18 text

Thank you!