我正在尝试使非阻塞gui在while循环中使用此代码执行代码但没有成功-窗口停止响应。我应该在该代码中进行哪些更改?
from Tkinter import *
import time
ROOT = Tk()
# create a Frame for the Text and Scrollbar
txt_frm = Frame(ROOT, width=600, height=600)
txt_frm.pack(fill="both", expand=True)
# ensure a consistent GUI size
txt_frm.grid_propagate(False)
# implement stretchability
txt_frm.grid_rowconfigure(0, weight=1)
txt_frm.grid_columnconfigure(0, weight=1)
# create a Text widget
txt = Text(txt_frm, borderwidth=3, relief="sunken")
txt.config(font=("consolas", 12), undo=True, wrap='word')
txt.grid(row=0, column=0, sticky="nsew", padx=2, pady=2)
# create a Scrollbar and associate it with txt
scrollb = Scrollbar(txt_frm, command=txt.yview)
scrollb.grid(row=0, column=1, sticky='nsew')
txt['yscrollcommand'] = scrollb.set
txt.insert(END, "hello\n")
txt.pack()
while True:
ROOT.update()
time.sleep(10)
txt.insert(END, "hello here\n")
txt.pack()
答案 0 :(得分:1)
我找到了可行的解决方案
VertxResteasyDeployment deployment = new VertxResteasyDeployment();
deployment.start();
deployment.getProviderFactory().register(new RequestIdFeature(getRequiredBean());
deployment.getRegistry().addPerInstanceResource(Processors.class);
vertx.createHttpServer()
.requestHandler(new VertxRequestHandler(vertx, deployment))
.listen(8080);