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

Excel formula to count words in a cell

It’s reports time again – specifically UCAS references time. And I need to write up to 140 words on each of my students.

I like using Excel for such things but was surprised there was no easy way of counting the words in each cell. I knew you could count characters using LEN() but not how to count the words…. till I found this post and this useful snippet:

=LEN(TRIM(text)) - LEN(SUBSTITUTE(text, " ", "")) + 1
Published
Categorised as News

Pushing ahead with Python

So this summer I’ve been coding in Python.

I’v decided to push this in my A Level classes more than learning VB.net, Javascript & PHP. Not because I don’t enjoy doing these languages, but that some students would struggle with switching between these. Perhaps code agnostism only comes with a maturity of having to learn different programming languages over the years?

Published
Categorised as News

Bitesize Revision for GCSE Computer Science






I’ve created a podcast for GCSE Computer Science students to revise topics in small “bite size” chunks.

I’m slowly releasing new episodes, but I’ve committed to doing an episode a week, as I realised people were actually listening to them.

You can either listen using the embed above or go direct to the page here, https://anchor.fm/bitesize-computer-science where you can leave an audio message, which I might include in a future podcast.

Published
Categorised as News

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

Visualise line by line code execution in Python

I stumbled across this website that allows you to visualise line by line execution ina Python program. This may be useful for students who are unclear about how a function (or blocks of code) run within a program:

http://pythontutor.com/visualize.html#code=def%20hi%28name%29%3A%0A%20%20%20%20print%28%22hello%20%22%20%2B%20name%29%0A%20%20%20%20%0Ahi%28%22bob%22%29%0Ahi%28%22jeff%22%29&cumulative=false&curInstr=8&heapPrimitives=nevernest&mode=display&origin=opt-frontend.js&py=3&rawInputLstJSON=%5B%5D&textReferences=false

This was recommended by Al Sweigart in his Automate The Boring Stuff with Python (https://automatetheboringstuff.com/)

Published
Categorised as News