[Python编程(第4版)].(Programming.Python.4th.Edition).Mark.Lutz.文字版

(yzsuai) #1

def init(self, parent, picdir, editclass, msecs=2000, size=Size):
self.msecs = msecs
self.editclass = editclass
SlideShow.init(self, parent, picdir, msecs, size)


def makeWidgets(self):
self.name = Label(self, text='None', bg='red', relief=RIDGE)
self.name.pack(fill=X)
SlideShow.makeWidgets(self)
Button(self, text='Note', command=self.onNote).pack(fill=X)
Button(self, text='Help', command=self.onHelp).pack(fill=X)
s = Scale(label='Speed: msec delay', command=self.onScale,
from_=0, to=3000, resolution=50, showvalue=YES,
length=400, tickinterval=250, orient='horizontal')
s.pack(side=BOTTOM, fill=X)
s.set(self.msecs)


1.2: need to know if editor destroyed, in popup or full component modes


self.editorGone = False
class WrapEditor(self.editclass): # extend PyEdit class to catch Quit
def onQuit(editor): # editor is PyEdit instance arg subject
self.editorGone = True # self is slide show in enclosing scope
self.editorUp = False
self.editclass.onQuit(editor) # avoid recursion


attach editor frame to window or slideshow frame


if issubclass(WrapEditor, TextEditorMain): # make editor now
self.editor = WrapEditor(self.master) # need root for menu
else:
self.editor = WrapEditor(self) # embedded or pop-up
self.editor.pack_forget() # hide editor initially
self.editorUp = self.image = None


def onStart(self):
SlideShow.onStart(self)
self.config(cursor='watch')


def onStop(self):
SlideShow.onStop(self)
self.config(cursor='hand2')


def onOpen(self):
SlideShow.onOpen(self)
if self.image:
self.name.config(text=os.path.split(self.image[0])[1])
self.config(cursor='crosshair')
self.switchNote()


def quit(self):
self.saveNote()
SlideShow.quit(self)


def drawNext(self):
SlideShow.drawNext(self)
if self.image:


PyView: An Image and Notes Slideshow | 733
Free download pdf