笔记本电脑关机快捷键(电脑怎么快速关机)

本文介绍了:普通人关机的习惯方式、以及程序员关机的方式哈!一、普通人关机0)优雅的关机1)快捷键关机使用快捷键关机相信是大家比较常用的方法了吧?也是最简单方便的方法。按下快捷键【Alt】+【F4】弹出

本文介绍了:普通人关机的习惯方式、以及程序员关机的方式哈!

一、普通人关机

0)优雅的关机

笔记本电脑关机快捷键(电脑怎么快速关机)

1)快捷键关机

使用快捷键关机相信是大家比较常用的方法了吧?也是最简单方便的方法。

按下快捷键【Alt】+【F4】弹出功能对话框,实现快速关机,又快又准效率极高。

笔记本电脑关机快捷键(电脑怎么快速关机)

2)任务管理器关机

这个方法和上一个快捷键关机的方法有着异曲同工之妙,按下快捷键【Alt】+【Ctrl】+

【Delete】,打开任务管理器,右下方有个圆形关机按钮,点击即可关机。

笔记本电脑关机快捷键(电脑怎么快速关机)

3)设置关机时间

这个方法可以实现定时关机,算好想要关机的时间,设置完成后电脑到点就会自动关机。再也不用

因为电脑关机更新而等个半天了。按下快捷键【win】+【R】,在运行对话框内输入《at20:00

shutdown-s》后点击确定,系统就会在晚上 8 点准时关机。这个方法可以在大家确定能够关机时间

的情况下使用还是非常方便的。

笔记本电脑关机快捷键(电脑怎么快速关机)

4)鼠标滑动关机

在电脑桌面位置创建一个快捷方式,在出现的对话框内输入“slidetoshutdown”后点下一步。

笔记本电脑关机快捷键(电脑怎么快速关机)

点击完成即可。

笔记本电脑关机快捷键(电脑怎么快速关机)

此时电脑桌面上就多了一个快捷方式,想要关机时双击该快捷方式,就会出现以下提示,滑动就可

以关闭电脑了。

笔记本电脑关机快捷键(电脑怎么快速关机)

二、程序员关机

嘿嘿~虽然确实正常人开关机上面的更方便快速哈!但是源码打包成 exe 点开更方便啦~尤其是在电

脑需要几个小时之后关机的,需要先让电脑自动完成任务再关机滴~呐这个还蛮方便的~也许,应

该更方便.jpg 强行解释的我 2333~这就是娱乐娱乐的代码哈哈哈哈~

1)Pyqt5 界面化小程序

1.1 附源码项目

# -*—coding:utf-8 -*-import sysimport os      # Python 执行系统命令方法所用到的包 from PyQt5 import QtCore,QtGui,QtWidgets  class Ui_shut(object):   #类 继承 object 类flag = Truedef setupUi(self,shut):  #方法    #设置窗体的大小shut.setObjectName(\"shut\")shut.resize(420,180)             shut.setFixedSize(420,180) self.label = QtWidgets.QLabel(shut)self.label.setGeometry(QtCore.QRect(40,50,41,51)) #标签的位置self.label.setFont(QtGui.QFont(\"Roman times\",10,QtGui.QFont.Bold))self.label.setObjectName(\"label\") self.lineEdit = QtWidgets.QLineEdit(shut)self.lineEdit.setGeometry(QtCore.QRect(70, 50, 71, 41))self.lineEdit.setFont(QtGui.QFont(\"Roman times\",10,QtGui.QFont.Bold))self.lineEdit.setObjectName(\"lineEdit\") self.label_2 = QtWidgets.QLabel(shut)self.label_2.setGeometry(QtCore.QRect(150, 60, 31, 31))self.label_2.setFont(QtGui.QFont(\"Roman times\",10,QtGui.QFont.Bold))self.label_2.setObjectName(\"label_2\") self.lineEdit_2 = QtWidgets.QLineEdit(shut)self.lineEdit_2.setGeometry(QtCore.QRect(180, 50, 71, 41))self.lineEdit_2.setFont(QtGui.QFont(\"Roman times\",10,QtGui.QFont.Bold))self.lineEdit_2.setObjectName(\"lineEdit_2\") self.label_3 = QtWidgets.QLabel(shut)self.label_3.setGeometry(QtCore.QRect(260, 60, 31, 31))self.label_3.setFont(QtGui.QFont(\"Roman times\",10,QtGui.QFont.Bold))self.label_3.setObjectName(\"label_3\") self.pushButton = QtWidgets.QPushButton(shut,clicked=self.sd)  #为 pushButton 添加监听事件 click。self.pushButton.setGeometry(QtCore.QRect(290, 50, 101, 41))self.pushButton.setFont(QtGui.QFont(\"Roman times\",10,QtGui.QFont.Bold))self.pushButton.setObjectName(\"pushButton\") self.label_4 = QtWidgets.QLabel(shut)self.label_4.setGeometry(QtCore.QRect(0, 120, 500, 31))self.label_4.setFont(QtGui.QFont(\"Roman times\",10,QtGui.QFont.Bold))self.label_4.setObjectName(\"label_4\") self.retranslateUi(shut)QtCore.QMetaObject.connectSlotsByName(shut) #connectSlotsByName 是一个 QMetaObject 类里的静态函数,其作用是用来将 QObject * o 里的子 QObject 的某些信号按照其 objectName 连接到 o 的槽上。         def retranslateUi(self,shut):_translate = QtCore.QCoreApplication.translateshut.setWindowTitle(_translate(\"shut\", \"Windows 定时关机器\"))self.label.setText(_translate(\"shut\", \"在:\"))self.label_2.setText(_translate(\"shut\", \"时\"))self.label_3.setText(_translate(\"shut\", \"分\"))self.label_4.setText(_translate(\"shut\", \"    请输入关机时间\"))self.pushButton.setText(_translate(\"shut\", \"设置\"))def sd(self,shut):        #self.sd 为触发该事件后,需要执行的操作。h = self.lineEdit.text()m = self.lineEdit_2.text()if self.flag:self.flag = Falsetry:                     #捕获所有异常os.popen(\'at\'+ h + \':\' + m + \' shutdown -s\') #python 执行 cmd 命令的方法self.label_4.setText(\'    设置成功! 系统将关机在今天 \'+h+\':\'+m)self.pushButton.setText(\'移除\')self.lineEdit.clear()self.lineEdit_2.clear()except:self.label_4.setText(\'Something is wrong~\')else:self.flag = Truetry:os.popen(\'at /delete /yes\')self.label_4.setText(\'成功,全部移除\')self.pushButton.setText(\'Set\')self.lineEdit.clear()self.lineEdit_2.clear()except:self.label_4.setText(\'Something is wrong\')

1.2 效果展示

笔记本电脑关机快捷键(电脑怎么快速关机)

2)Tkinter 界面化小程序

2.1 附源码项目

from tkinter import ttkimport osimport tkinter.messagebox as message_boxwindows = tkinter.Tk()windows.title(\"Python 定时关机\")# window 居中 windows.update()  # update window ,must docurWidth = 280  # get current widthcurHeight = windows.winfo_reqheight()  # get current heightscnWidth, scnHeight = windows.maxsize()  # get screen width and height# now generate configuration informationconfig = \'%dx%d+%d+%d\' % (curWidth, curHeight,                          (scnWidth - curWidth) / 2, (scnHeight - curHeight) / 2)windows.geometry(config)# root 容器 root = ttk.LabelFrame(windows, text=\"关机命令\")root.grid(column=0, row=0, padx=15, pady=15)# 提醒文本 tkinter.Label(root, text=\"输入时间\").grid(column=0, row=0, sticky=tkinter.W)tkinter.Label(root, text=\"选择\").grid(column=1, row=0)# 存储输入的值 time = tkinter.StringVar()unit = tkinter.StringVar()# 输入框 time_edit = tkinter.Entry(root, width=10, textvariable=time)time_edit.grid(column=0, row=1, padx=4, sticky=tkinter.W)time_edit.focus()# 下拉单位选择 unit_arr = (\'时\', \'分\', \'秒\')unit_chosen = ttk.Combobox(root, width=6, textvariable=unit, state=\'readonly\')unit_chosen[\'values\'] = unit_arrunit_chosen.grid(column=1, row=1)unit_chosen.current(0)def change_edit(to_time):    time_edit.delete(0, 10)    time_edit.insert(0, to_time)    unit_chosen.current(1)# startdef start():    if time.get() and unit.get():        message_box.showwarning(\"选择完毕\", \"你的电脑将在多少 %s %s\" % (time.get(), unit.get()))        # shutdown 的秒数        count_down_second = int(time.get())        if unit.get() == \'hour\':            count_down_second *= 3600        elif unit.get() == \'minute\':            count_down_second *= 60        # execute        os.system(\"shutdown -s -t %s\" % count_down_second)        windows.quit()# canceldef cancel():    os.system(\"shutdown -a\")    windows.quit()# start 按钮 start_action = tkinter.Button(root, text=\"START\", command=start)start_action.grid(column=2, row=1)# 文本 tip_label = tkinter.Label(root, text=\"倒计时关机\")tip_label.grid(row=2, column=0, pady=2)# 快捷选择时间 fram = tkinter.Frame(root)fram.grid(row=3, column=0, columnspan=3)# 常用的时间 for i in range(2, 7):    button = tkinter.Button(fram, text=str(i * 15) + \"min\", command=lambda x=i: change_edit(str(x * 15)))    button.grid(row=0, column=i - 2, padx=2, pady=2, sticky=tkinter.W)# cancel 按钮 cancel_action = tkinter.Button(root, text=\"CANCEL\", command=lambda: cancel())cancel_action.grid(row=4, column=1, pady=10, sticky=tkinter.W)

2.2 效果展示

笔记本电脑关机快捷键(电脑怎么快速关机)


本文内容由互联网用户自发贡献,该文观点仅代表作者本人。如发现本站有涉嫌抄袭侵权/违法违规的内容,请发送邮件至 203304862@qq.com 举报,一经查实,本站将立刻删除。本文链接:https://xz1898.com/n/195188.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-03-14 19:12
下一篇 2023-03-14 19:13

相关推荐

发表回复

登录后才能评论

联系我们

在线咨询: QQ交谈

邮件:97552693@qq.com

工作时间:周一至周五,9:30-18:30,节假日休息