如何防止tkinter向导格式一次显示所有页面?

如何防止tkinter向导格式一次显示所有页面?,tkinter,wizard,Tkinter,Wizard,希望我能把这说得足够具体。我正在构建一个应用程序,用于在我目前的工作地点进行激光切割机培训(正如你们中的一些人最近看到的)。我已经能够成功地创建一个向导,引导学员完成每个过程,但是我遇到了向导格式的问题 所发生的不是Python Shell中显示的错误,因此就解释器而言,代码没有问题。但是,当我打开向导时,它希望一次显示所有页面。我可以单击“下一页”和“上一页”按钮,它会清除,但我无法完成第四页,因为它会将按钮推到屏幕之外,因此无法触及(我的屏幕分辨率无法容纳整个窗口,并且按钮总是从底部开始,无

希望我能把这说得足够具体。我正在构建一个应用程序,用于在我目前的工作地点进行激光切割机培训(正如你们中的一些人最近看到的)。我已经能够成功地创建一个向导,引导学员完成每个过程,但是我遇到了向导格式的问题

所发生的不是Python Shell中显示的错误,因此就解释器而言,代码没有问题。但是,当我打开向导时,它希望一次显示所有页面。我可以单击“下一页”和“上一页”按钮,它会清除,但我无法完成第四页,因为它会将按钮推到屏幕之外,因此无法触及(我的屏幕分辨率无法容纳整个窗口,并且按钮总是从底部开始,无论指定的位置如何)

如果有人能告诉我是什么导致了这个问题,以及我如何解决它,我将非常感谢你的帮助

我已经把代码贴在下面了。我只要求了解,因为这是真实的最复杂的应用程序,我已经建立了DOS的计算器,我用C++几年后。换句话说,这是我的第一个GUI应用,也是我的第一个python应用。因此,我在python和stackoverflow方面的经验非常有限

请注意,加载的某些模块不是向导的一部分。他们在应用程序的其他地方扮演角色

#Import the Modules required for proper app function
import os, cgi, pickle
from os.path import *
from tkinter import *
import tkinter

#All other windows must be created as Definitions before the Home Screen/Main Menu is coded.
#All Button Commands must be created as Definitions before their respective windows

#Start Code for the Introduction Wizard
def wizIntro():
    wizIntro = tkinter.Tk()

    #Title:
    wizIntro.title('Welcome to Training')

    #Content:
    page1 = Frame(wizIntro)
    Label(page1, text='', width=110).pack()
    Label(page1, text='--Welcome to Training--', width=85).pack()
    Label(page1, text='', width=85).pack()
    Label(page1, text='This tutorial will help you familiarize yourself with the program.  Following it is key to understanding', width=85).pack()
    Label(page1, text='the proper operation of the Laser Cutter.', width=85).pack()
    Label(page1, text='', width=90).pack()
    Label(page1, text='It is also important to follow every insrtuction exactly as stated, to avoid or minimize damage to the Laser', width=85).pack()
    Label(page1, text='Cutter and reduce the risk of injury to the operator and those around him.', width=85).pack()
    Label(page1, text='Therefore, all safety notices must be followed with extreme care.', width=110).pack()
    Label(page1, text='--Failure to follow all safety notices poses a severe risk of damage to the equipment and to the operator, which can be fatal--', width=110, fg='red').pack()
    Label(page1, text='', width=110).pack()
    Label(page1, text='', width=110).pack()
    Label(page1, text='', width=110).pack()
    Label(page1, text='Click Next to Continue...').pack(side = BOTTOM)
    page1.pack()

    page2 = Frame(wizIntro)
    Label(page2, text='', width=110).pack()
    Label(page2, text='Notice:  Before anyone can operate the Laser Cutter, they must have completed this training program and be authorized as an operator.', width=110).pack()
    Label(page2, text='FAILURE TO FOLLOW THIS POLICY MAY RESULT IN IMMEDIATE TERMINATION OF EMPLOYMENT', fg='red').pack()
    Label(page2, text='', width=110).pack()
    Label(page2, text='Once again, it is very important to follow all safety precautions and notices.  Failure to do so can result in one or more of the following:', width=110).pack()
    Label(page2, text='*Severe burning', width=110).pack()
    Label(page2, text='*Severe damage to, or loss of, fingers', width=110).pack()
    Label(page2, text='*Temporary or permanent blindness', width=110).pack()
    Label(page2, text='*Minor to Severe damage to the Laser Cutter and/or its components', width=110).pack()
    Label(page2, text='', width=110).pack()
    Label(page2, text='On the next screen, you will see a list of precautions to follow.', width=110).pack()
    Label(page2, text='', width=110).pack()
    Label(page2, text='', width=110).pack()
    Label(page2, text='...Click Previous to go Back, or Click Next to Continue...').pack(side = BOTTOM)
    page2.pack()

    page3 = Frame(wizIntro)
    Label(page3, text='', width=110).pack()
    Label(page3,  text='--Safety Precautions--', width=110).pack()
    Label(page3, text='', width=110).pack()
    Label(page3, text='1.  Do not look at the laser tube or at the laser strike-point without proper eyewear or through the glass on the Laser Cutter.', width=110).pack()
    Label(page3, text='2.  Do not attempt to overide the Door Safety Sensor to allow the laser to cut with the door open.', width=110).pack()
    Label(page3, text='3.  Keep hands clear of all moving parts and refrain from touching the mirrors with bare hands.', width=110).pack()
    Label(page3, text='4.  Do not make any adjustments to the laser calibration without proper training and authorization from your superviser.', width=110).pack()
    Label(page3, text='5.  Do not remove any covers except for the bottom-front (and only to empty the boxes behind said cover) without permission.', width=110).pack()
    Label(page3, text='6.  Keep a constant awareness and/or watch on the laser as it cuts, and cancel the cut-cycle as soon as problems occur,', width=110).pack()
    Label(page3, text='such as fires or when stamps catch on the Laser Head.', width=110).pack()
    Label(page3, text='7.  Report any problems that will cause the Laser Cutter to not operate properly to your supervisor immediately.', width=110).pack()
    Label(page3, text='Above all else, make safety your Highest Priority', width=110, fg='red').pack()
    Label(page3, text='', width=110).pack()
    Label(page3, text='...Click Previous to go Back, or Click Next to Continue...').pack(side = BOTTOM)
    page3.pack()

    page4 = Frame(wizIntro)
    Label(page4, text='', width=110).pack()
    Label(page4, text='...Click Previous to go Back, or Click Next to Continue...').pack(side = BOTTOM)
    page4.pack()

    #Commands:
    pages = [page1, page2, page3, page4]
    current = page1
    def move(dirn):
        nonlocal current
        idx = pages.index(current) + dirn
        if not 0 <= idx < len(pages):
            return
        current.pack_forget()
        current = pages[idx]
        current.pack(side = TOP)

    def nex():
        move(+1)

    def prev():
        move(-1)

    Button(wizIntro, text='Previous', command=prev).pack(side = LEFT)
    Button(wizIntro, text='Next', command=nex).pack(side = RIGHT)

    #End Code for the Introduction Wizard
#导入正确应用程序功能所需的模块
导入操作系统、cgi、pickle
从os.path导入*
从tkinter进口*
进口tkinter
#在主屏幕/主菜单编码之前,必须将所有其他窗口创建为定义。
#所有按钮命令必须在各自的窗口之前创建为定义
#介绍向导的启动代码
def wizIntro():
wizIntro=tkinter.Tk()
#标题:
wizIntro.title(“欢迎参加培训”)
#内容:
第1页=帧(wizIntro)
标签(第1页,文本=“”,宽度=110).pack()
标签(第1页,文本='--欢迎参加培训--',宽度=85).pack()
标签(第1页,文本='',宽度=85).pack()
Label(第1页,text=)本教程将帮助您熟悉该程序。以下内容是理解',width=85.pack()的关键
标签(第1页,text='激光切割机的正确操作',宽度=85).pack()
标签(第1页,文本='',宽度=90).pack()
标签(第1页,text=,同样重要的是严格按照说明进行操作,以避免或尽量减少对激光器的损坏’,宽度=85)。pack()
标签(第1页,文本:“‘减少操作员及其周围人员受伤的风险’”,宽度=85)。包装()
标签(第1页,text='因此,必须极其小心地遵守所有安全注意事项。',宽度=110).pack()
标签(第1页,文本='--不遵守所有安全注意事项会对设备和操作员造成严重的损坏风险,这可能是致命的--',宽度=110,fg='red')。pack()
标签(第1页,文本=“”,宽度=110).pack()
标签(第1页,文本=“”,宽度=110).pack()
标签(第1页,文本=“”,宽度=110).pack()
标签(第1页,text='单击下一步继续…')。包装(侧面=底部)
第1页包装()
第2页=帧(wizIntro)
标签(第2页,文本='',宽度=110).pack()
Label(第2页,text='注意:任何人在操作激光切割机之前,必须完成本培训课程并获得操作员授权。',宽度=110)。pack()
标签(第2页,text='未能遵守此政策可能导致立即终止雇佣关系',fg='red')。pack()
标签(第2页,文本='',宽度=110).pack()
标签(第2页,text=)再次强调,遵守所有安全预防措施和注意事项非常重要。否则可能导致以下一种或多种情况:',宽度=110)。pack()
标签(第2页,文本=“*严重燃烧”,宽度=110).pack()
标签(第2页,文本='*手指严重损坏或丢失',宽度=110)。包装()
标签(第2页,文本='*暂时性或永久性失明',宽度=110).pack()
标签(第2页,文本='*激光切割机和/或其部件的轻微至严重损坏',宽度=110)。包装()
标签(第2页,文本='',宽度=110).pack()
标签(第2页,text='在下一个屏幕上,您将看到要遵循的预防措施列表',宽度=110)。pack()
标签(第2页,文本='',宽度=110).pack()
标签(第2页,文本='',宽度=110).pack()
标签(第2页,文本='…单击上一页返回,或单击下一步继续…)。包装(侧面=底部)
第2页包装()
第3页=帧(wizIntro)
标签(第3页,文本='',宽度=110).pack()
标签(第3页,文本='--安全注意事项--',宽度=110).pack()
标签(第3页,文本='',宽度=110).pack()
标签(第3页,text='1.在没有合适的眼镜或通过激光切割机上的玻璃时,不要看激光管或激光照射点。',宽度=110)。pack()
标签(第3页,text='2.不要试图越过车门安全传感器,以允许激光在车门打开的情况下切割。),宽度=110.pack()
标签(第3页,text='3.保持手远离所有活动部件,避免徒手触摸镜子',宽度=110)。包装()
标签(第3页,text='4.未经主管的适当培训和授权,请勿对激光校准进行任何调整。“,宽度=110).pack()
标签(第3页,text='5.未经允许,不得移除除底部正面以外的任何封盖(仅清空封盖后面的盒子)。',宽度=110.pack()
标签(第3页,text='6.在激光切割时保持持续的感知和/或监视,并在出现问题时立即取消切割周期,',宽度=110)。pack()
标签(第3页,text=,例如火焰或激光头上的邮票,宽度=110)。pack()
标签(第3页,text='7.立即向您的主管报告任何可能导致激光切割机无法正常工作的问题。“,宽度=110)。pack()
标签(第3页,text=)最重要的是,将安全作为您的最高标准
...
page1 = Frame(wizIntro)
...
page1.pack()
page2 = Frame(wizIntro)
...
page2.pack()
...