如何在Tkinter中打开关闭的窗口?

时间:2020-07-27 12:29:37

标签: python tkinter

我正在尝试创建一个可以打开另一个.py文件的应用程序(Tkinter应用程序)。 我尝试了下面的代码,并且它是第一次工作(它第一次打开另一个应用程序),但是如果我关闭该应用程序并尝试通过单击打开按钮再次打开它,则它不会第二次打开。

主要应用:

from tkinter import *
root=Tk()
def ope():
  import SecondApp
Open_1=Button(root,text="Open",command=ope)
Open_1.pack()
root.mainloop()

SecondApp:

from tkinter import *
root1=Tk()
Label=Label(root1,text="Hey welcome in second app")
Label.pack()
root1.mainloop()

如果我第一次从mainapp中单击Open_1 button,那么它将在那个时间打开第二个应用程序,但是如果我再次尝试,则第二次它什么也没做。 最后,我想使用import SecondApp打开第二个窗口 请尽快帮助我。感谢所有尝试解决我的问题的人

1 个答案:

答案 0 :(得分:0)

您可以使用public function up() { Schema::create('options', function (Blueprint $table) { $table->increments('id'); $table->string('title'); $table->string('category'); }); } 创建第二个窗口

尝试以下代码:

public function up()
{
    Schema::create('selections', function (Blueprint $table) {
        $table->unsignedBigInt('plan_id');
        $table->unsignedBigInt('1');
        $table->unsignedBigInt('2');
        $table->unsignedBigInt('3');
        $table->unsignedBigInt('4');
        $table->unsignedBigInt('5');
        $table->unsignedBigInt('6');
    });
}