selected completely at random from the photo file directory +figure - buttonpics gets political while we're playinglet' recode this script as class in case we ever want to attach or customize it later (it could happenespecially in more realistic programsit' mostly matter of indenting and adding self before global variable namesas shown in example - example - pp \gui\tour\buttonpics py from tkinter import from glob import glob import democheck import random gifdir /gifs/get base widget set filename expansion list attach check button example to me pick picture at random default dir to load gif files class buttonpicsdemo(frame)def __init__(selfgifdir=gifdirparent=none)frame __init__(selfparentself pack(self lbl label(selftext="none"bg='blue'fg='red'self pix button(selftext="press me"command=self drawbg='white'self lbl pack(fill=bothself pix pack(pady= democheck demo(selfrelief=sunkenbd= pack(fill=bothfiles glob(gifdir "gif"self images [(xphotoimage(file= )for in filesprint(filesdef draw(self)namephoto random choice(self images+this particular image is not my creationit appeared as banner ad on developer-related websites such as slashdot when the book learning python was first published in it generated enough of backlash from perl zealots that 'reilly eventually pulled the ad altogether which may be whyof courseit later appeared in this book tkinter tourpart