Using Figma to design Python Tkinter GUIs

There’s only so far you can get with Python before you realise the command line is pretty, well, boring. And you hanker for something graphical, with colours and buttons and different fonts. What you need my friend is a Graphical User Interface(GUI)

There are a variety of GUIs available to Python. The one that comes as standard is a library called Tkinter. Other ones I have used in teh past are appjar and guizero but these involve separate installs. Tkinter is the underlying GUI that powers the popular Turtle module. However designing an interface in Tkinter can be baffling. How do you know where your buttons and labels will appear? What I was looking for was a simple way to create an interface using a drag n drop system, so I can plan it out by eye rather than some arbitrary layout chosen by Tkinter.

If you have ever programmed in Visual Basic you’ll know that in the development environment Visual Studio is a great tool for allowing you to drag and drop buttons and labels and textboxes around a window to your heart’s content. Could there be something similar for Python? The answer is, not quite.

After looking at this article: https://www.webapptiv.com/blog/python-drag-and-drop-gui-builders/ I was intrigued by the method they mentioned for using Figma (online prototyping tool) to design the interface and then get that ported into a usable Python program. Intrigued, I read on.

The instructions are documented here: https://github.com/ParthJadhav/Tkinter-Designer/blob/master/docs/instructions.md

Published
Categorised as Python

Python exercises in the browser from Data Camp



#use the variables below to print out "Hello Laura"
name = "Laura"
greeting = "Hello"

print out "Hello Laura"

name = "Laura"
greeting = "Hello"


print(greeting +" "+name)


test_function("print")
success_msg("Good stuff!")


Put variables into a print function

https://github.com/datacamp/datacamp-light-wordpress



#print the numbers 0 to 19

print the numbers 0 to 19

for i in range(10):
print(i)


for i in range(20):
print(i)


success_msg("Good stuff!")


Change the 10 to 20

FutureLearn – Object Oriented Programming in Python

I came across this course on the Raspberry Pi Certified Educators Course this October. It piqued my interest as it uses a text based adventure game to introduce OOP concepts to learners.

I had previously done this with an idea of a Space Invaders game using Visual Basic.NET. This was a fun introduction to concepts and it is easy to create classes and objects in VB. However my current cohort of learners are mostly unfamiliar with VB and have a better grasp of Python.

The course is written by Laura Sach, who I finally met at PiCademy after years of following her on Twitter. And I  thouroughly recommend it as an accessible way of understanding Object Oriented Principles in Python

https://www.futurelearn.com/courses/object-oriented-principles/