Persistence and systematic problem solving required for programmers

capture

The code below was expected to generate the above example of using an image as background to a window. It didn’t. And after a couple of hours I only just got it working. The problem was largely the development environment (Pyscripter). It reminded me that students cutting code need both persistence and the patience required to follow a systematic problem solving process. These are challenging behaviors and skills for young people to acquire…

from tkinter import *
class GUI:
def __init__(self):
window = Tk()
window.title(“image test”)
window.minsize(width=600, height=400)
self.background_image= PhotoImage(file=”board.gif”)
self.background_label = Label(window, image=self.background_image)
self.background_label.place(x=0, y=0, relwidth=1, relheight=1)

heading_label = Label(window, bg=”black”, fg=”red”, text=”Classes”, font=(“Times”,”24″))
heading_label.pack()

name_label = Label(window, text=’Enter Name:’)
name_label.pack(anchor=”c”)
self.name_field = Entry(window)
self.name_field.pack(anchor=”c”)
window.mainloop()

#initialises the programme
GUI()

Advertisements
This entry was posted in Uncategorized and tagged , . Bookmark the permalink.

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s