-
Notifications
You must be signed in to change notification settings - Fork 0
/
imagedemo.py
41 lines (33 loc) · 1.22 KB
/
imagedemo.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
"""
Author: Leigh Stauffer
Project 1
File: imagedemo.py
"""
from breezypythongui import EasyFrame
from tkinter import PhotoImage
from tkinter.font import Font
class ImageDemo(EasyFrame):
"""Displays an image and a caption."""
def __init__(self):
"""Sets up the window and widgets."""
EasyFrame.__init__(self, title = "Image Demo")
self.setResizable(False)
imageLabel = self.addLabel(text = "",
row = 0, column = 0,
sticky = "NSEW")
textLabel = self.addLabel(text = "Smokey the cat",
row = 1, column = 0,
sticky = "NSEW")
# Load the image and associate it with the image label.
self.image = PhotoImage(file = "smokey.gif")
imageLabel["image"] = self.image
# Set the font and color of the caption.
font = Font(family = "Verdana", size = 20, slant = "italic")
textLabel["font"] = font
textLabel["foreground"] = "blue"
def main():
"""The starting point for launching the program."""
ImageDemo().mainloop()
# Instantiates and pops up the window.
if __name__ == "__main__":
main()