程序重启
This commit is contained in:
parent
3b2e988025
commit
e00a9a803a
6 changed files with 48 additions and 6 deletions
|
@ -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 />
|
|
@ -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" />
|
30
程序重启/AutoRestart.py
Normal file
30
程序重启/AutoRestart.py
Normal 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
10
程序重启/README.md
Normal 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>
|
BIN
程序重启/ScreenShot/1.png
Normal file
BIN
程序重启/ScreenShot/1.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.6 KiB |
BIN
程序重启/dist/AutoRestart.exe
vendored
Normal file
BIN
程序重启/dist/AutoRestart.exe
vendored
Normal file
Binary file not shown.
Loading…
Reference in a new issue