Exemple #1
0
    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)

        self.editorGone = False

        class WrapEditor(self.editclass):
            def onQuit(editor):
                self.editorGone = True
                self.editorUp = False
                self.editclass.onQuit(editor)

        if issubclass(WrapEditor, TextEditorMain):
            self.editor = WrapEditor(self.master)
        else:
            self.editor = WrapEditor(self)
        self.editor.pack_forget()
        self.editorUp = self.image = None
    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
Exemple #3
0
    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: msecs 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: 在弹窗或全组件模式中,如果销毁了编辑器则需要知道
        self.editorGone = False

        class WrapEditor(self.editclass):  # 扩展 PyEdit 类至捕获退出
            def onQuit(editor):  # 编辑器时 PyEdit 实例参数面向对象
                self.editorGone = True  # 在封闭范围中自身是幻灯片放映
                self.editorUp = False
                self.editclass.onQuit(editor)  # 避免递归

        # 附加编辑器框架至窗口或幻灯片放映框架
        if issubclass(WrapEditor, TextEditorMain):  # 现在制造编辑器
            self.editor = WrapEditor(self.master)  # 需要根菜单
        else:
            self.editor = WrapEditor(self)  # 嵌入或弹出
        self.editor.pack_forget()  # 开始隐藏编辑器
        self.editorUp = self.image = None
Exemple #4
0
    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 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)

        self.editorGone = False
        class WrapEditor(self.editclass):
            def onQuit(editor):
                self.editorGone = True
                self.editorUp = False
                self.editclass.onQuit(editor)

        if issubclass(WrapEditor, TextEditorMain):
            self.editor = WrapEditor(self.master)
        else:
            self.editor = WrapEditor(self)
        self.editor.pack_forget()
        self.editorUp = self.image = None
Exemple #6
0
 def drawNext(self):
     """
     绘制下一幅图
     """
     SlideShow.drawNext(self)
     if self.image:
         self.name.config(text=os.path.split(self.image[0])[1])
     self.loadNote()
 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)
     if self.editclass == TextEditorMain:          # make editor now
         self.editor = self.editclass(self.master) # need root for menu
     else:
         self.editor = self.editclass(self)        # embedded or popup
     self.editor.pack_forget()                     # hide editor initially
     self.editorUp = self.image = None
 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)
     if self.editclass == TextEditorMain:  # make editor now
         self.editor = self.editclass(self.master)  # need root for menu
     else:
         self.editor = self.editclass(self)  # embedded or popup
     self.editor.pack_forget()  # hide editor initially
     self.editorUp = self.image = None
Exemple #9
0
    def makeWidgets(self):
        self.name = Label(self, text="None", bg="red", relief=RIDGE)  # 顶部label,显示图片文件名
        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,  # 添加Scale刻度组件
            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 #使编辑器消除标记置为True,说明其已被destroy
                self.editorUp = False  # 这里的self是嵌套作用域中的self,指的是
                self.editclass.onQuit(editor)  # avoid recursion       #SlideShowPlus实例,而editor则是编辑器实例

        # attach editor frame to window or slideshow frame                  #如果传进来的editclass是TextEditorMain类型
        if issubclass(WrapEditor, TextEditorMain):  # make editor now    #那么需要传递父窗体给编辑器的构造函数,因为它
            self.editor = WrapEditor(self.master)  # need root for menu #需要构造基于窗体的menu,TextEditorMainPopup
        else:  # 不需要是因为它内部使用了一个toplevel作为父窗体
            self.editor = WrapEditor(self)  # embedded or pop-up
        self.editor.pack_forget()  # hide editor initially  刚开始应该隐藏编辑框
        self.editorUp = self.image = None
Exemple #10
0
 def __init__(self, parent, picdir, editclass, msecs=2000, size=Size):
     self.msecs = msecs
     self.editclass = editclass
     SlideShow.__init__(self, parent, picdir, msecs, size)
Exemple #11
0
 def onStart(self):  # 扩展onStart
     SlideShow.onStart(self)
     self.config(cursor="watch")
 def __init__(self, parent, picdir, editclass, msecs=2000):
     self.msecs = msecs
     self.editclass = editclass
     SlideShow.__init__(self, parent=parent, picdir=picdir, msecs=msecs)
Exemple #13
0
 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()
Exemple #14
0
 def onOpen(self):  # 扩展onOpen
     SlideShow.onOpen(self)
     if self.image:
         self.name.config(text=os.path.split(self.image[0])[1])  # 打开图片后在label上显示图片文件名
     self.config(cursor="crosshair")
     self.switchNote()  # 切换标注文件
Exemple #15
0
# Note: can also start multiple copies of canvaspics.py
# running in parallel, from operatin system: using '&'
# in UNIX shell, double clicking on the file name more
# than one in Windows explorer, and so on; as coded here,
# the windows receive user events independently, but
# are part of the same process;

import sys
from Tkinter import *
from slideShow import SlideShow

if len(sys.argv) == 2:
    picdir = sys.argv[1]
else:
    picdir = '../gifs'

root = Tk()
Label(root, text="Two embedded slide shows: Toplevel windows").pack()
SlideShow(msecs=1000, parent=Toplevel(root), picdir=picdir).pack()
SlideShow(msecs=1000, parent=Toplevel(root), picdir=picdir).pack()
root.mainloop()
Exemple #16
0
 def onStart(self):
     SlideShow.onStart(self)
     self.config(cursor='spider')
 def __init__(self, parent, picdir, editclass, msecs=2000):
     self.msecs = msecs
     self.editclass = editclass
     SlideShow.__init__(self, parent=parent, picdir=picdir, msecs=msecs)
Exemple #18
0
 def drawNext(self):
     SlideShow.drawNext(self)
     if self.image:
         self.name.config(text=os.path.split(self.image[0])[1])
     self.loadNote()
 def __init__(self):
     SlideShow.__init__(self)
     self.scl_picConfig()
     self.scl_thumb = self.makeSclThumbs()
     self.canv_thumb = self.makeCanvThumbs()
Exemple #20
0
 def onStop(self):  # 扩展onStop
     SlideShow.onStop(self)
     self.config(cursor="hand2")
 def __init__(self, parent, picdir, editclass, msecs=2000, size=Size):
     self.msecs = msecs
     self.editclass = editclass
     SlideShow.__init__(self, parent, picdir, msecs, size)
Exemple #22
0
 def onStart(self):
     SlideShow.onStart(self)
     self.config(cursor='watch')
 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()
Exemple #24
0
 def onStop(self):
     SlideShow.onStop(self)
     self.config(cursor='hand2')
 def quit(self):
     self.saveNote()
     SlideShow.quit(self)
Exemple #26
0
 def quit(self):
     self.saveNote()
     SlideShow.quit(self)
Exemple #27
0
 def quit(self):  # 退出程序
     self.saveNote()
     SlideShow.quit(self)
Exemple #28
0
 def __init__(self):
     SlideShow.__init__(self)
     self.scl_picConfig()
     self.scl_thumb = self.makeSclThumbs()
     self.canv_thumb = self.makeCanvThumbs()
 def onStart(self):
     SlideShow.onStart(self)
     self.config(cursor='watch')
import sys
from tkinter import *
from slideShow import SlideShow

if len(sys.argv) == 2:
    picdir = sys.argv[1]
else:
    picdir = '../gifs'

root = Tk()
Label(root,
      text="Two embedded slide shows: each side uses after() loop").pack()
SlideShow(msecs=200, parent=root, picdir=picdir, bd=3,
          relief=SUNKEN).pack(side=LEFT)
SlideShow(msecs=200, parent=root, picdir=picdir, bd=3,
          relief=SUNKEN).pack(side=RIGHT)
root.mainloop()
 def onStop(self):
     SlideShow.onStop(self)
     self.config(cursor='hand2')