python获取windows进程 标题_关于Python 获取windows信息收集

#!/usr/bin/python#-*-coding:utf-8-*-#shutdown.py

import sys#导入

importosfrom PyQt4.QtCore import *

from PyQt4.QtGui import *

classShutDown(QWidget):def __init__(self):

super(ShutDown, self).__init__()

self.setWindowTitle('PyQt')

self.hourLabel= QLabel(u'小时')#标签

self.minuteLabel = QLabel(u'分钟')

self.secondLabel= QLabel(u'秒')

self.shutDownButton= QPushButton()#按钮

self.shutDownButton.setText(u'关机')

self.shutDownButton.clicked.connect(self.confirm_shutdown)

self.rebootButton=QPushButton()

self.rebootButton.setText(u'重启')

self.rebootButton.clicked.connect(self.confirm_reboot)

self.logoffButton=QPushButton()

self.logoffButton.setText(u'注销')

self.logoffButton.clicked.connect(self.confirm_logoff)

self.hourSpinBox=QSpinBox()

self.hourSpinBox.setRange(0,1000)

self.hourSpinBox.setSingleStep(1)

self.hourSpinBox.setValue(0)

self.minuteSpinBox=QSpinBox()

self.minuteSpinBox.setRange(0,1000)

self.minuteSpinBox.setSingleStep(1)

self.minuteSpinBox.setValue(0)

self.secondSpinBox=QSpinBox()

self.secondSpinBox.setRange(0,1000)

self.secondSpinBox.setSingleStep(1)

self.secondSpinBox.setValue(0)

self.layout= QGridLayout()#网格布局

self.layout.addWidget(self.hourLabel,1,0)

self.layout.addWidget(self.hourSpinBox,1,1)

self.layout.addWidget(self.minuteLabel,1,2)

self.layout.addWidget(self.minuteSpinBox,1,3)

self.layout.addWidget(self.secondLabel,1,4)

self.layout.addWidget(self.secondSpinBox,1,5)

self.layout.addWidget(self.shutDownButton,2,0,2,2)

self.layout.addWidget(self.rebootButton,2,2,2,2)

self.layout.addWidget(self.logoffButton,2,4,2,2)

self.setLayout(self.layout)defconfirm_shutdown(self):

self.time= (self.hourSpinBox.value() * 3600 + self.minuteSpinBox.value() * 60

+self.secondSpinBox.value())

shutdown= 'C:\Windows\System32\shutdown.exe -s -t' +str(self.time)

os.system(shutdown)

sys.exit(0)defconfirm_reboot(self):

reboot= 'C:\Windows\System32\shutdown.exe -r'os.system(reboot)

sys.exit(0)defconfirm_logoff(self):

logoff= 'C:\Windows\System32\shutdown.exe -l'os.system(logoff)

sys.exit(0)if __name__ == '__main__':

app=QApplication(sys.argv)

shutdown=ShutDown()

shutdown.show()

sys.exit(app.exec_())

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值