程序重启

This commit is contained in:
Irony 2017-03-31 15:34:28 +08:00
parent 3b2e988025
commit e00a9a803a
6 changed files with 48 additions and 6 deletions

View file

@ -3,8 +3,10 @@
### [Python3.4.4 or Python3.5][PyQt5]
# 1.<a href="右下角弹出框/">右下角弹出框</a><br />
### 1.<a href="右下角弹出框/">右下角弹出框</a><br />
# 2.<a href="单实例应用/">单实例应用</a><br />
### 2.<a href="单实例应用/">单实例应用</a><br />
# 3.<a href="字体测试/">字体测试</a><br />
### 3.<a href="字体测试/">字体测试</a><br />
### 4.<a href="程序重启/">程序重启</a><br />

View file

@ -1,8 +1,8 @@
#右下角弹出框
# 右下角弹出框
<br />
###[Python3.4.4 or Python3.5][PyQt5]
### [Python3.4.4 or Python3.5][PyQt5]
#截图
# 截图
<img src="ScreenShot/1.png" />
<img src="ScreenShot/2.png" />

View file

@ -0,0 +1,30 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
Created on 2017年3月31日
@author: Irony."[讽刺]
@site: alyl.vip, orzorz.vip, irony.coding.me , irony.iask.in , mzone.iask.in
@email: 892768447@qq.com
@file: AutoRestart
@description:
'''
from optparse import OptionParser
import os
import sys
import time
def restart(twice):
os.execl(sys.executable, sys.executable, *[sys.argv[0], "-t", twice])
if __name__ == "__main__":
parser = OptionParser(usage="usage:%prog [optinos] filepath")
parser.add_option("-t", "--twice", type="int", dest="twice", default=1, help="运行次数")
options, _ = parser.parse_args()
print("app start...%s...twice\n" % options.twice)
print("app pid: ",os.getpid())
print("3秒后自动重启...\n")
time.sleep(3)
restart(str(options.twice + 1))

10
程序重启/README.md Normal file
View file

@ -0,0 +1,10 @@
# 程序重启
<br />
### [Python3.4.4 or Python3.5][PyQt5]
# 截图
<img src="ScreenShot/1.png" />
# exe 下载
<a href="dist/AutoRestart.exe">AutoRestart.exe</a>

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB

BIN
程序重启/dist/AutoRestart.exe vendored Normal file

Binary file not shown.