My Very First Python App – A Digital Bookmark

Persistence without Focus or Direction

When I first began to study Python programming a few months ago, creating an app, no matter how simple, seemed like a pipe dream. While I was beginning to understand some of the Pythonic concepts in theory, I didn’t know how to apply them. I battled on with broadly unrelated books, articles and courses, but this inevitably lead to a lack of focus and belief on my part. I knew the principles behind learning something new, but it seemed like I spent a lot of time in persistence mode while being out of sync with the focus and incremental progress that I also needed.

Connect the dots with Python OOP

Prior to taking the Python OOP Course I had read a little bit about object oriented programming but not an awful lot sank in. I was still coming from a place of trying to comprehend what a function, class and method was. This course has given me a sense focus and direction that I previously didn’t have. I firmly believe in starting small, keeping things as simple as they possibly can be, and building on my skill sets from a solid foundation. I feel this course has given me this along with the practicalities of tangible apps to start a portfolio with. The great thing about this course is it’s ROI on time and money. A student could easily get through the course in a matter of hours. Personally, I have chosen to gradually work my way through it while working on solving other problems and using other resources for learning Python. My first real app that I have made as part of this course is the below version of a digital bookmark.

Digital Bookmark

As part of the Python OOP course, I recently created a bookmark for my favourite websites.  I used the tkinter module to create the window.

Screen Shot 2017-04-21 at 09.31.10

Bookmark Customisations

I made two main customisations from the tutorial I followed.

  1. Change background colour.
  2. Include an image.

To do this I had to do my own research. It would be much easier for me to stick to exactly what I am shown but that is not what I am encouraged to do, and I won’t be able to retain the principles behind what I am learning if I do so. While my mind can sometimes be lazy, I find that it is often open to making small tweaks. Below is a description of the two adjustments I made, while my mind was telling me this seems like too much work:

Background Colour

To change the background colour of the window I simply had to add this line of code:


Sometimes the most noticeable changes are the easiest to implement 🙂

Adding an Image

I imported the PhotoImage module from tkinter in order to insert the GIF image.

from tkinter import PhotoImage

P1 = PhotoImage(file=”image.gif”)

I initially wanted to use a JPEG image but it wouldn’t work for me. From what I read it seems to be easier to insert a GIF image in tkinter. I don’t fully understand why this is but I felt that it wasn’t necessary at this stage to pursue the answer any further. Once I saw that the GIF image appeared, I then spent my time positioning the image to where I liked it best.


I used the .grid method to position the elements in the bookmark window. There are 3 main ways to position in tkinter

  1. Pack
  2. Grid
  3. Place

When using the .grid method the window is divided into grids with unique coordinates for row and column. The positioning is relative. For items to appear horizontally the row value remains constant while the column values increment, for items to appear vertically the column values remain constant while the row values increment. Here is a table to demonstrate this logic when inserting buttons in a window with the .grid method:

Vertical Buttons Horizontal Buttons
column=0 row=0 column=0 row=0
column=0 row=1 column=1 row=0
column=0 row=2 column=2 row=0
column=0 row=3 column=3 row=0

Here is a tutorial on tkinter positioning, that goes into more detail.

DRY (Don’t Repeat Yourself) example

The Cleverprogrammer landing page and the Cleverprogammer Blog have the same beginning to the URL. The only difference is that there is a /blog in the blog URL. Therefore, in the course, we created a variable called URL and to direct to the blog we simply used the variable name URL + /blog.

Source Code

Screen Shot 2017-04-21 at 09.31.24

So there you have it, with my first app in Python now completed, I am looking forward to seeing what problems and apps I can tackle next 🙂

Did you find this blog post useful? I am continuously looking for ways to improve on the content so that my readers have the best experience possible. If you have any insights, questions or recommendations feel free to leave a comment or drop me an e-mail.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s