TkinterHtml在调用mainloop后立即超时

2024-10-01 00:33:55 发布

您现在位置:Python中文网/ 问答频道 /正文

每次我运行程序时,窗口都不会弹出。它只是在运行后超时。 我的代码如下:

#Made by nullfact0r (I'd do this better but I'm trying to get this done in under a week)
#Copyright 2019

#Imports
import sys
import os
import urllib.request
import tkinter as tk
from tkinterhtml import HtmlFrame

#Functions
def main():
    root = tk.Tk()
    frame = HtmlFrame(root,horizontal_scrollbar="auto")
    frame.grid(sticky=tk.NSEW)
    #frame.set_content(urllib.request.urlopen("").read().decode())
    frame.set_content(open("index.html","r").read())
    root.columnconfigure(0,weight=1)
    root.rowconfigure(0,weight=1)
    root.mainloop()
#Main
if __name__ == "__main__":
    main()

Tags: 代码import程序readmainrequestrootcontent