繁体   English   中英

我如何关闭python但保持执行运行

[英]How i close python but keep execute running

所以我有两个调用快捷方式的按钮,但我需要关闭正在运行的 python 但调用的程序继续运行。 因为每次我按下按钮时,蟒蛇都会关闭并且过程永远不会继续

任何的想法?

谢谢。

import os
import tkinter as tk
from tkinter import *

def vulkan():
    os.startfile (r"F:\\Games\\RetroArch\\retroarch_vulkan.lnk")
    root.quit()

def default():
    os.startfile (r"F:\\Games\\RetroArch\\retroarch_gl.lnk")
    root.quit()

HEIGHT = 600
WIDTH = 800

root = tk.Tk()
root.title("Pick your choise")

screen_width = root.winfo_screenwidth()
screen_height = root.winfo_screenheight()

x_coordinate = (screen_width/2) - (WIDTH/2)
y_coordinate = (screen_height/2) - (HEIGHT/2)

root.geometry ("%dx%d+%d+%d" % (WIDTH, HEIGHT, x_coordinate, y_coordinate))

canvas = tk.Canvas(root, height=HEIGHT, width=WIDTH)
canvas.pack()

#frame = tk.Frame(root, highlightbackground='black', highlightthickness=1, bd=10)
frame = tk.Frame(root, bd=10)
frame.place(relx = 0.5, rely=0.5, relwidth=0.95, relheight=0.95, anchor="c")

button = tk.Button(frame, text="RetroArch Vulkan", font=60, command=lambda: vulkan())
button.place(relx = 0.05, relwidth=0.4, relheight=1)

button2 = tk.Button(frame, text="RetroArch glcore", font=60, command=lambda: default())
button2.place(relx = 0.55, relwidth=0.4, relheight=1)

root.mainloop()

使用 pip install pyinstaller 转换为 exe,然后 pyinstall --onefile (yourapp).py 然后运行 ​​exe? 如果您不想要控制台,请执行 pyinstall --noconsole --onefile (yourapp).py

暂无
暂无

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

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