繁体   English   中英

为什么我的 Toplevel() 窗口显示空白

[英]Why is my Toplevel() window showing blank

我已经有一段时间了,已经尝试了很多我可以在网上找到的方法,但似乎没有解决我的问题。 我的 Toplevel() 窗口什么也不显示。 在某个时候,这应该是我程序的一部分。 不得不复制代码并以这种方式总结它,但它不起作用。 我想我错过了一些东西

from tkinter import *
# from tkinter import ttk

# import sqlite3


# conn = sqlite3.connect('shengen.db')

# c = conn.cursor()

# q = c.execute(
#     "SELECT email FROM users WHERE email=('ichibuokem@gmail.com');")
# conn.commit()

# for i in q:
#     print(list(i))

def portal_start():
    portal = Toplevel(root)
    portal.title("Visa Application Form")
    portal.geometry("600x600")
    portal.iconbitmap("...\Visa-Application-Management-System\icon.ico")

    Label(portal, text="", bg="grey", height="2",
          width="900", font=("Calibri", 14)).pack(pady=10)

    spc = Label(portal, text="")
    spc.pack()

    portal_notebook = ttk.Notebook(portal)
    portal_notebook.pack()

    page1 = Frame(portal_notebook, width=600, height=600)
    page2 = Frame(portal_notebook, width=600, height=600)
    page3 = Frame(portal_notebook, width=600, height=600)
    page4 = Frame(portal_notebook, width=600, height=600)
    summary = Frame(portal_notebook, width=600, height=600)

    page1.pack(fill="both", expand=1)
    page2.pack(fill="both", expand=1)
    page3.pack(fill="both", expand=1)
    page4.pack(fill="both", expand=1)
    summary.pack(fill="both", expand=1)

    portal_notebook.add(page1, text="Basic Details")
    portal_notebook.add(page2, text="Sponsorship")
    portal_notebook.add(page3, text="Medicals")
    portal_notebook.add(page4, text="References")
    portal_notebook.add(summary, text="Summary")


# ============================================Portal End===================================================


# =============================================Instantiation window=======================================


def window():
    global root
    root = Tk()
    root.geometry("900x700")
    root.title("Welcome Page")
    root.iconbitmap("..\Visa-Application-Management-System\icon.ico")

    Label(root, text="Welcome To Python Visa Application Portal! \n\nTo check your visa application status, file a new application or update your application, \nLogin or Create an account.",
          fg="white", bg="grey", height="6", width="900", font=("Calibri", 14)).pack()
    Label(root, text="").pack()
    Label(root, text="").pack()
    Label(root, text="").pack()
    Label(root, text="").pack()
    Label(root, text="").pack()
    Button(root, text="Login", width=20, font=(
        "bold", 14)).pack()
    Label(root, text="").pack()
    Button(root, text="Create Account", width=20,
           font=("bold", 14)).pack()
    Label(root, text="").pack()
    Label(root, text="").pack()
    Label(root, text="Copyright 2020. All Rights Reserved \nWith Luv From Group 3",
          font=("Calibri", 8)).pack()

    Button(root, text="Test Window", width=20,
           font=("bold", 14), command=portal_start).pack()
    Label(root, text="").pack()

    root.mainloop()


window()

将此添加到您的代码的顶部

from tkinter import ttk

那么它应该可以完美运行

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM