Loading video player…

Getting TKInter Up and Running

00:00 Getting Up and Running With tkinter If you’ve installed Python with the official installers available for Windows and macOS from python.org, then you should have no problem running the code seen on screen.

00:13 But if you haven’t installed Python with the official installers or there’s no official distribution for your system, then here are some tips for getting up and running.

00:23 The Python distribution for macOS on Homebrew doesn’t come bundled with the Tcl/Tk dependency that’s required for tkinter. The default system version is used instead, and this version may be outdated and prevent you from importing the tkinter module.

00:39 To avoid this problem, use the official macOS installer. To conserve memory space, the default version of the Python interpreter that comes pre-installed on Ubuntu Linux has no support for Tkinter.

00:53 But if you want to continue using the Python interpreter bundled with the operating system, then you can install the package seen on screen. This will install the Python GUI tkinter module.

01:05 If you’re unable to get a working Python installation on your flavor of Linux, then you can build Python with the correct version of Tcl/Tk from the source code.

01:16 For a step-by-step walkthrough of this process, check out this Real Python guide.

01:22 Also note that if you’re using an alternate Python shell, such as Bpython or ptpython, you may find that the tkinter window doesn’t open straight away when you issue the commands to do so.

01:34 So while you’re getting familiar with the library, stick to the Python standard REPL instead, as this will react in the same way as you see on screen.

01:43 Now that you have tkinter up and running, in the next section of the course, you’ll start using it by building your first GUI application.

Become a Member to join the conversation.