python小脚本

编译环境pychram 2023.01

import tkinter as tk
import pyautogui
import os
import time
from tkinter import messagebox
import datetime
from tkinter import *
from PIL import Image, ImageTk
from playsound import playsound
import winsound
#以下地址读者自行修改#
global_uu_address = 'D:\\UU加速器\\Netease\\UU\\uu.exe'
global_douyu_address ='https://www.douyu.com/g_APEX'
global_VPN_address ='D:\\VPN\\v2rayN-Core\\v2rayN.exe'
global_Chat_GPT_address ='https://chat.openai.com/chat'
global_youtube_address ='https://www.youtube.com/'
global_TIM_address ='D:\\腾讯一家子\\Tim_\\Bin\\QQScLauncher.exe'
global_zhiwang_address ='https://co2.cnki.net/Login.html?dp=cduestc'
global_CSDN_address ='https://blog.csdn.net/RHJflash?spm=1010.2135.3001.5343'
global_cloud_music_address ='D:\\网易云音乐\\CloudMusic\\cloudmusic.exe'
global_wkikpedia_address ='https://zh.wikipedia.org/zh-cn/Wikipedia:%E9%A6%96%E9%A1%B5'
global_background_photo ='D:\\PHOTO\\后期\\20220313\\2.png'
global_background_music_button_address ='C:\\Users\\Desktop\\1.wav'
global_github_address = 'https://github.com/'
global_gongshishibie_address = 'https://simpletex.cn/ai/latex_ocr'#公式识别网址
global_liuchenngtuhuizi_address = 'https://www.processon.com/diagrams'#绘制流程图网址



def update_time():
    # 获取当前时间并格式化
    current_time = current_time = datetime.datetime.now().strftime('                            %Y-%m-%d %H:%M:%S.%f                            ')[:-3]
    # 更新 Label 组件的文本
    time_label.config(text=current_time)
    # 每隔1ms钟更新一次时间
    root.after(20, update_time)
#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%#
# 创建主窗口
root = tk.Tk()
root.title("俊_nuo_小脚本")
root.geometry("450x600")
# 加载背景图
bg_image = Image.open(global_background_photo)
bg_photo = ImageTk.PhotoImage(bg_image)
# 创建背景图标签并将其放置在窗口上
bg_label = tk.Label(root, image=bg_photo)
bg_label.place(x=0, y=0, relwidth=1, relheight=1)
# 设置窗口置顶
root.wm_attributes("-topmost", True)
# 创建用于显示时间的标签
time_label = tk.Label(root, font=("Arial", 13), fg="red",bg="blue")
time_label.pack(side='top', anchor='nw')
# 开始更新时间
update_time()
# 定义下拉框选项和回调函数
options = [
            "open APEX",
            "open douyu",
            "sign into TIM",
            "open zhiwang",
            "open CSDN",
            "open youtube",
            "open wikipedia",
            "open NETcloudmusic",
            "open Chatgpt",
            "open github",
            "open 流程图绘制网站",
            "open 公式识别网站"

           ]
variable = tk.StringVar(root)
variable.set(options[0])

def select_option(value):
    # 创建下拉框
    import webbrowser
    option = variable.get()
    # 记录选择下拉框的时间
    selected_time = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')
    # 将选择下拉框的时间添加到输出文本框中
    code_display.insert(tk.END, f"Selected {option} at {selected_time}\n")
    ###########################
    if option == "open APEX":
        # 打开UU加速器
        os.startfile(global_uu_address)
        code_display.insert(tk.END, "The APEX is Open success!\n")
        # 将光标定位到文本框最后一行
        code_display.see(tk.END)
    ###########################
    elif option == "open douyu":
        webbrowser.open(global_douyu_address)
        code_display.insert(tk.END, "The douyu  is Open success!\n")
        # 将光标定位到文本框最后一行
        code_display.see(tk.END)
    ###########################
    elif option == "sign into TIM":
        os.startfile(global_TIM_address)
        code_display.insert(tk.END, "The TIM is open success!\n")
        # 模拟按下回车键
        # 等待1秒,确保TIM已经打开
        time.sleep(3)
        pyautogui.press('enter')
        code_display.insert(tk.END, "The enter is Press success!\n")
        # 将光标定位到文本框最后一行
        code_display.see(tk.END)
    ###########################
    elif option == "open zhiwang":
        # 弹出警告框
        messagebox.showinfo("Waring!!!", "关闭ACC!!!")
        webbrowser.open(global_zhiwang_address)
        code_display.insert(tk.END, "The zhiwang is Open success! \n")
        # 将光标定位到文本框最后一行
        code_display.see(tk.END)
    ###########################
    elif option == "open CSDN":
        webbrowser.open(global_CSDN_address)
        code_display.insert(tk.END, "The  CSDN is Open success! \n")
        # 将光标定位到文本框最后一行
        code_display.see(tk.END)
    ###########################
    elif option == "open youtube":
        os.startfile(global_VPN_address)
        webbrowser.open(global_youtube_address)
        code_display.insert(tk.END, "The youtube is Open success! \n")
        # 将光标定位到文本框最后一行
        code_display.see(tk.END)
    ###########################
    elif option == "open wikipedia":
        # 打开wikipedia
        os.startfile(global_VPN_address)
        webbrowser.open(global_wkikpedia_address)
        code_display.insert(tk.END, "The wikipedia is Open success! \n")
        # 将光标定位到文本框最后一行
        code_display.see(tk.END)
    ###########################
    elif option == "open NETcloudmusic":
        # 打开网易云音乐
        os.startfile(global_cloud_music_address)
        code_display.insert(tk.END, "The cloud music is open success!\n")
        # 将光标定位到文本框最后一行
        code_display.see(tk.END)
    ###########################
    elif option == "open Chatgpt":
        os.startfile(global_VPN_address)
        webbrowser.open(global_Chat_GPT_address)
        code_display.insert(tk.END, "The VPN is Open \n")
        code_display.insert(tk.END, "The Chat_GPT  is  Open success!\n")
        # 将光标定位到文本框最后一行
        code_display.see(tk.END)
    ###########################
    elif option == "open github":
        # 打开github
        os.startfile(global_VPN_address)
        webbrowser.open(global_github_address)
        code_display.insert(tk.END, "The github is Open success \n")
        # 将光标定位到文本框最后一行
        code_display.see(tk.END)
    ###########################
    elif option == "open 流程图绘制网站":
        # 打开流程图绘制网站
        os.startfile(global_liuchenngtuhuizi_address)
        code_display.insert(tk.END, "流程图绘制网站打开成功!\n")
        # 将光标定位到文本框最后一行
        code_display.see(tk.END)
    ###########################
    elif option == "open 公式识别网站":
        # 公式识别网站
        webbrowser.open(global_gongshishibie_address)
        code_display.insert(tk.END, "公式识别网站打开成功!\n")
        # 将光标定位到文本框最后一行
        code_display.see(tk.END)
dropdown = tk.OptionMenu(root, variable, *options, command=select_option)
dropdown.pack(side='top', fill="x")
# 设置下拉框宽度为窗口宽度
dropdown.config(width=root.winfo_width())
root.option_add('*TCombobox*Listbox*Width', root.winfo_width())

# 显示下拉框
dropdown.pack()
# 创建文本框
code_display = tk.Text(root, height=20, bg="#EFEFEF", highlightthickness=10, highlightbackground="white")
code_display.place(x=0, y=0)
code_display.pack(pady=0)
# 创建按钮
#btn_tim = tk.Button(root, text="登录TIM", command=open_tim, bg="white", activebackground="white")
#btn_tim.pack(pady=10)

#btn_open_zhiwang = tk.Button(root, text="知网网址", command=open_zhiwang, bg="white", activebackground="white")
#btn_open_zhiwang.pack(pady=10)

# 进入主循环
root.mainloop()





在这里插入图片描述

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

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值