draft https://www.cnblogs.com/shadow-wolf/p/6524603.html

import wx
import wx.grid
import sqlite3

#保存路径
row0 = [“日期”,“张三”,“李四”,“王五”]
data0 = [“001”, “小明”, “1班”, “软件工程”]
data1 = [“006”, “小莉”, “3班”, “计算机科学与技术”]

datalist = [data0,data1]

本地数据库

class WorkDb:
def init(self, work_db):
self.db = work_db

def connect(self):
    return sqlite3.connect(self.db)

class DataTable(wx.grid.GridTableBase):
def init(self):
wx.grid.GridTableBase.init(self)

    work_db_file = "student11.db"
    self.wb = WorkDb(work_db_file)

    self.colLabels = row0
    self.datalist = datalist



    self.rows_count = len(datalist)
    self.cols_count = len(data0)




    self.odd = wx.grid.GridCellAttr()
    self.odd.SetBackgroundColour((255,255,255))
    self.odd.SetFont(wx.Font(10, wx.SWISS, wx.NORMAL, wx.BOLD))

    self.even = wx.grid.GridCellAttr()
    self.even.SetBackgroundColour((200,200,250))
    self.even.SetFont(wx.Font(10, wx.SWISS, wx.NORMAL, wx.BOLD))

def GetNumberRows(self):
    return len(datalist)

def GetNumberCols(self):
    return self.cols_count

def IsEmptyCell(self, row, col):
    return self.datalist[row][col] is not None

def GetValue(self, row, col):
    value = self.datalist[row][col]
    if value is not None:
        return value
    else:
        return ''


def GetAttr(self, row, col, kind):
    attr = [self.even, self.odd][row % 2]
    attr.IncRef()
    return attr

def GetColLabelValue(self, col):
    return self.colLabels[col]

class DMFrame(wx.Frame):
def init(self,xx):

    wx.Frame.__init__(self, None, title="", size=(640, 480))

    self.Sizer = wx.BoxSizer(wx.VERTICAL)

    self.key_str = wx.TextCtrl(self, -1,value=xx)
    self.btn_srch = wx.Button(self, -1, "查询")
    # self.btn_srch.BackgroundColour = "blue"
    self.hbox = wx.BoxSizer(wx.HORIZONTAL)

    self.hbox.Add(self.key_str, 0, flag=wx.LEFT, border=10)
    self.hbox.Add(self.btn_srch, 0, flag=wx.LEFT, border=10)

    # self.btn_srch.Bind(wx.EVT_BUTTON, self.SrchData, self.btn_srch)


    self.grid = wx.grid.Grid(self)

    self.table = DataTable()
    self.grid.SetTable(self.table, True)


    self.Sizer.Add(self.hbox, 0, wx.TOP, border=5)
    self.Sizer.Add(self.grid, 1, wx.TOP|wx.EXPAND, border=5)
    self.CreateStatusBar()
    self.SetStatusText("编辑信息!")

#数据库的初始化
def init_db(dbpath):
initsql = “drop table if exists studentTable” #判断studentTable表是否存在,如果存在,则删除

createsql = '''
    create table if not exists studentTable
    (
        id integer primary key autoincrement ,
        studentId varchar ,
        studentName varchar ,
        studentGrade varchar ,
        studentClass varchar 
    )
'''                             #新建studentTable数据表

conn = sqlite3.connect(dbpath)   #打开或创建 连接数据库文件
cursor = conn.cursor()           #获取游标
cursor.execute(initsql)          # 执行SQL语句
cursor.execute(createsql)        #执行SQL语句
conn.commit()                    #提交数据库操作
conn.close()                     #关闭数据库连接

dbpath = “student11.db”
init_db(dbpath)
conn = sqlite3.connect(dbpath) # 连接数据库文件
cur = conn.cursor() # 获取游标

cur.execute(“SELECT date(‘now’)”)
print(cur.fetchone()[0])
xx = str(cur.fetchone()[0])
print(type(xx))

for data in datalist:
cur.execute(“insert into studentTable(studentId, studentName, studentGrade, studentClass )values(?, ?, ?, ?)”,
(data[0], data[1], data[2], data[3])) # 执行SQL语句
conn.commit() #提交数据库操作
cur.close()
conn.close() #关闭数据库连接

app = wx.App()

商品管理

df = DMFrame(goods())

联系人管理

df = DMFrame(xx)
df.Show()
app.MainLoop()

import wx
import sys
import base64
import wx
from io import BytesIO
with open(“08.jpg”, ‘rb’) as f:
base64_data = base64.b64encode(f.read())
pic_data = base64_data.decode()

#!/usr/bin/env python

-- encoding:utf-8 --

import wx

class PyEmbeddedImage(object):
def init(self, data, isBase64=True):
self.data = data
self.isBase64 = isBase64

def GetBitmap(self):
    return wx.Bitmap(self.GetImage())

def GetData(self):
    data = self.data
    if self.isBase64:
        data = base64.b64decode(self.data)
    return data

def GetIcon(self):
    icon = wx.Icon()
    icon.CopyFromBitmap(self.GetBitmap())
    return icon

def GetImage(self):
    stream = BytesIO(self.GetData())
    return wx.Image(stream)

继承Frame

class ListControl(wx.Frame):

def __init__(self, *args, **kwargs):
    super(ListControl, self).__init__(*args, **kwargs)

    self.picture = PyEmbeddedImage(pic_data).GetBitmap()
    # 初始化窗口UI
    self.init_ui()

def init_ui(self):
    # 面板
    panel = wx.Panel(self)

    # self.data = [("1949", "四月", "119")]
    self.data = [(self.picture, self.picture,self.picture)]
    # 多项列表
    list_ctrl = wx.ListCtrl(panel, id=wx.ID_ANY, size=(900, 500),style=wx.LC_ICON)
    # list_ctrl = wx.ListCtrl(panel, id=wx.ID_ANY, size=(900, 500),style=wx.LC_REPORT)
    list_ctrl.InsertColumn(0, "年份", width=100)
    list_ctrl.InsertColumn(1, "月份", width=100)
    list_ctrl.InsertColumn(2, "飞行次数", wx.LIST_FORMAT_RIGHT, 120)
    for i in self.data:
        index = list_ctrl.InsertItem(sys.maxsize, i[0])
        list_ctrl.SetItem(index, 1, i[1])
        list_ctrl.SetItem(index, 2, i[2])
    self.Bind(wx.EVT_LIST_ITEM_SELECTED, self.select_item, list_ctrl)
    self.SetSize(900, 500)
    self.SetTitle("列表的应用")
    self.Centre()
    self.Show(True)

def select_item(self, e):
    list_ctrl = e.GetEventObject()
    index = e.GetIndex()
    # 选中所在行的数据
    col1 = list_ctrl.GetItemText(index, 0)
    col2 = list_ctrl.GetItemText(index, 1)
    col3 = list_ctrl.GetItemText(index, 2)
    print(col1, col2, col3)

def main():
app = wx.App(False)
ListControl(None)
app.MainLoop()

# app = wx.PySimpleApp()

# app = wx.App(False)
# # frame = wx.Frame(None, -1, size=(300,300))
# my_panel = ListControl(None)
# my_panel.Show()
# app.MainLoop()

if name == “main”:
main()

from django.db import models

Create your models here.

class Notices(models.Model):
id = models.AutoField(‘记录编号’,primary_key = True)
title = models.CharField(‘通知标题’,max_length=32,null=False)
detail = models.CharField(‘通知详情’,max_length=125,null=False)
createTime = models.CharField(‘通知时间’,db_column=‘create_time’,max_length= 19)
class Meta:
db_table = ‘notice’

class Statistics(models.Model):
id = models.AutoField(‘记录编号’,primary_key = True)
creatTime = models.CharField(‘统计时间’,db_column=‘create_time’,max_length=10)
confirm = models.IntegerField(‘累计确诊’,null=False)
heal = models.IntegerField(‘累计治愈’,null=False)
dead = models.IntegerField(‘累计死亡’,null= False)
nowconfirm = models.IntegerField(‘当前确诊’,db_column=‘now_confirm’,null=False)
class Meta:
db_table = ‘statistics’

class Users(models.Model):
id = models.AutoField(‘记录编号’,primary_key = True)
userName = models.CharField(‘用户账号’,db_column=‘user_name’,max_length=32,null= False)
passWord = models.CharField(‘用户密码’,max_length=32,null=False)
name = models.CharField(‘用户姓名’,max_length=20,null=False)
gender = models.CharField(‘用户性别’,max_length=4,null=False)
age = models.CharField(‘用户年龄’,null=False)
phone = models.CharField(‘联系电话’,max_length=4,null=False)
address = models.CharField(‘联系地址’,max_length=4,null=False)
type = models.IntegerField(‘用户身份’,null=False)
class Meta:
db_table = ‘users’

class Checklogs(models.Model):
id = models.AutoField(‘记录编号’,primary_key = True)
createTime = models.CharField(‘检查时间’,db_column=‘create_time’,max_length=19)
loc = models.CharField(‘检查地点’,max_length=64,null=False)
resl = models.CharField(‘检查结果’,max_length=2,null=False)
detail = models.CharField(‘检查详情’,max_length=125,null=False)
user = models.ForeignKey(Users,on_delete=models.CASCADE,db_column=‘user_id’)
class Meta:
db_table = ‘check_logs’

class abnormityLogs(models.Model):
id = models.AutoField(‘记录编号’,primary_key = True)
createTime = models.CharField(‘登记时间’,db_column= ‘create_time’,max_length=19)
detail = models.CharField(‘检查详情’,max_length= 125, null= False)
user = models.ForeignKey(Users,on_delete=models.CASCAD,db_column=‘user_id’)
class Meta:
db_table = ‘abnorimity_logs’

class VaccinateLogs(models.Model):
id = models.AutoField(‘记录编号’,primary_key = True)
name = models.CharField(‘接种人员姓名’,max_length=20,null=False)
card = models.CharField(‘身份证号’,max_length=18,null=False)
phone = models.CharField(‘联系电话’,max_length=11,null=False)
address = models.CharField(‘联系地址’,max_length=64,null=False)
detail = models.CharField(‘检查详情’,max_length=125,null=False)
vaccinateNo = models.CharField(‘接种次数’,db_column=‘vaccinate_no’,max_length=2,null=False)
vaccinateTime = models.CharField(‘接种时间’,db_column=‘vaccinate_time’,max_length=10,null=False)

import wx
import math
import time
import pyaudio
import wave
import wx.lib.filebrowsebutton
from multiprocessing import Process
import pyperclip
import pyautogui
import win32gui
import re
import win32con
import time
import webbrowser as web
from selenium import webdriver

class MyCalculator(wx.Frame):
def init(self):
super().init(parent=None, title=“”, size=(835, 1020),
style=wx.DEFAULT_FRAME_STYLE^(wx.MAXIMIZE_BOX))
self.Center()
panel = wx.Panel(parent=self)
panel.SetBackgroundColour(‘grey’)
panel.Center()
font = wx.Font(16, wx.ROMAN, wx.NORMAL, wx.BOLD, underline=False)

    self.boxsize = wx.GridBagSizer(5,5)
    self.equation = ""
    self.result = 0
    self.ResultFlag = 0

    line = wx.StaticLine(panel)
    self.boxsize.Add(line, pos=(0, 0), span=(1, 15), flag=wx.EXPAND | wx.BOTTOM | wx.TOP)

    text = wx.StaticText(panel, -1, label="发帖定时控制", style=wx.ALIGN_LEFT)
    font1 = wx.Font(12, wx.ROMAN, wx.ITALIC, wx.NORMAL)

    text.SetForegroundColour("white")
    text.SetBackgroundColour("black")
    font2 = wx.Font(18, wx.ROMAN, wx.ITALIC, wx.NORMAL)
    text.SetFont(font2)
    self.boxsize.Add(text, pos=(1, 0), span=(1, 15))

    line = wx.StaticLine(panel)
    self.boxsize.Add(line, pos=(2, 0), span=(1, 15), flag=wx.EXPAND | wx.BOTTOM | wx.TOP)


    t = time.strftime("%H:%M:%S", time.localtime())  # 设置初始值
    t = "当前时间:" + t
    self.text1 = wx.StaticText(panel, -1, t)
    font = wx.Font(22, wx.DEFAULT, wx.FONTSTYLE_NORMAL, wx.NORMAL, faceName="黑体")
    self.text1.SetFont(font)
    self.text1.SetForegroundColour("white")

    self.timer = wx.Timer(self)  # 创建一个计时器对象
    self.Bind(wx.EVT_TIMER, self.Time, self.timer)  # 绑定计时器事件
    self.timer.Start(1000)  # 计时器计时1秒

    self.boxsize.Add(self.text1, pos=(3, 0), span=(1, 2))

    textclk = wx.StaticText(panel, -1,label = "发帖时间1:", style=wx.ALIGN_LEFT | wx.ALIGN_CENTRE |wx.ALIGN_CENTRE_VERTICAL)
    font = wx.Font(22, wx.DEFAULT, wx.FONTSTYLE_NORMAL, wx.NORMAL, faceName="黑体")
    textclk.SetFont(font)
    textclk.SetForegroundColour("white")
    self.boxsize.Add(textclk, pos=(4, 0),flag=wx.TOP | wx.LEFT | wx.BOTTOM, span=(1, 1))

    self.text_alarm_p1 = wx.TextCtrl(panel)
    # self.text_alarm_p = wx.TextCtrl(panel, pos=(0, 0), style=wx.TE_READONLY)
    self.text_alarm_p1.SetFont(font)  # 文本框里面格式
    self.text_alarm_p1.BackgroundColour = 'white'
    self.boxsize.Add(self.text_alarm_p1, pos=(4,1),span=(1,3),flag=wx.EXPAND | wx.LEFT | wx.RIGHT, border=5)

    textclk = wx.StaticText(panel, -1,label = "(模块1)", style=wx.ALIGN_LEFT | wx.ALIGN_CENTRE |wx.ALIGN_CENTRE_VERTICAL)
    font = wx.Font(22, wx.DEFAULT, wx.FONTSTYLE_NORMAL, wx.NORMAL, faceName="黑体")
    textclk.SetFont(font)
    textclk.SetForegroundColour("white")
    self.boxsize.Add(textclk, pos=(4, 4),flag=wx.TOP | wx.LEFT | wx.BOTTOM, span=(1, 1))

    self.time_button = wx.Button(panel, wx.ID_ANY, "RUN")
    font2 = wx.Font(18, wx.ROMAN, wx.ITALIC, wx.NORMAL)
    self.time_button.SetFont(font2)
    self.boxsize.Add(self.time_button,pos=(4, 5) , span=(3,3), flag=wx.EXPAND | wx.LEFT | wx.RIGHT, border=5)



    self.time_button.Bind(wx.EVT_BUTTON, self.run)


    textclk = wx.StaticText(panel, -1,label = "发帖时间2:", style=wx.ALIGN_LEFT | wx.ALIGN_CENTRE |wx.ALIGN_CENTRE_VERTICAL)
    font = wx.Font(22, wx.DEFAULT, wx.FONTSTYLE_NORMAL, wx.NORMAL, faceName="黑体")
    textclk.SetFont(font)
    textclk.SetForegroundColour("white")
    self.boxsize.Add(textclk, pos=(5, 0),flag=wx.TOP | wx.LEFT | wx.BOTTOM, span=(1, 1))

    self.text_alarm_p = wx.TextCtrl(panel, pos=(0, 0))
    self.text_alarm_p.SetFont(font)  # 文本框里面格式
    self.text_alarm_p.BackgroundColour = 'white'
    self.boxsize.Add(self.text_alarm_p, pos=(5,1),span=(1,3),flag=wx.EXPAND | wx.LEFT | wx.RIGHT, border=5)

    textclk = wx.StaticText(panel, -1,label = "(模块2)", style=wx.ALIGN_LEFT | wx.ALIGN_CENTRE |wx.ALIGN_CENTRE_VERTICAL)
    font = wx.Font(22, wx.DEFAULT, wx.FONTSTYLE_NORMAL, wx.NORMAL, faceName="黑体")
    textclk.SetFont(font)
    textclk.SetForegroundColour("white")
    self.boxsize.Add(textclk, pos=(5, 4),flag=wx.TOP | wx.LEFT | wx.BOTTOM, span=(1, 1))



    textclk = wx.StaticText(panel, -1,label = "发帖时间3:", style=wx.ALIGN_LEFT | wx.ALIGN_CENTRE |wx.ALIGN_CENTRE_VERTICAL)
    font = wx.Font(22, wx.DEFAULT, wx.FONTSTYLE_NORMAL, wx.NORMAL, faceName="黑体")
    textclk.SetFont(font)
    textclk.SetForegroundColour("white")
    self.boxsize.Add(textclk, pos=(6, 0),flag=wx.TOP | wx.LEFT | wx.BOTTOM, span=(1, 1))

    self.text_alarm_p = wx.TextCtrl(panel, pos=(0, 0))
    self.text_alarm_p.SetFont(font)  # 文本框里面格式
    self.text_alarm_p.BackgroundColour = 'white'
    self.boxsize.Add(self.text_alarm_p, pos=(6,1),span=(1,3),flag=wx.EXPAND | wx.LEFT | wx.RIGHT, border=5)

    textclk = wx.StaticText(panel, -1,label = "(模块3)", style=wx.ALIGN_LEFT | wx.ALIGN_CENTRE |wx.ALIGN_CENTRE_VERTICAL)
    font = wx.Font(22, wx.DEFAULT, wx.FONTSTYLE_NORMAL, wx.NORMAL, faceName="黑体")
    textclk.SetFont(font)
    textclk.SetForegroundColour("white")
    self.boxsize.Add(textclk, pos=(6, 4),flag=wx.TOP | wx.LEFT | wx.BOTTOM, span=(1, 1))


    line = wx.StaticLine(panel)
    self.boxsize.Add(line, pos=(7, 0), span=(1, 15), flag=wx.EXPAND | wx.BOTTOM | wx.TOP)

    text = wx.StaticText(panel, -1,label = "发帖信息输入", style=wx.ALIGN_LEFT)
    font1 = wx.Font(12, wx.ROMAN, wx.ITALIC, wx.NORMAL)

    text.SetForegroundColour("white")
    text.SetBackgroundColour("black")
    font2 = wx.Font(18, wx.ROMAN, wx.ITALIC, wx.NORMAL)
    text.SetFont(font2)
    self.boxsize.Add(text, pos=(8, 0), span=(1, 15))

    line = wx.StaticLine(panel)
    self.boxsize.Add(line, pos=(9, 0), span=(1, 15), flag=wx.EXPAND | wx.BOTTOM | wx.TOP)



    textclk = wx.StaticText(panel, -1,label = "发帖标题:", style=wx.ALIGN_LEFT | wx.ALIGN_CENTRE |wx.ALIGN_CENTRE_VERTICAL)
    font = wx.Font(22, wx.DEFAULT, wx.FONTSTYLE_NORMAL, wx.NORMAL, faceName="黑体")
    textclk.SetFont(font)
    textclk.SetForegroundColour("white")
    self.boxsize.Add(textclk, pos=(10, 0),flag=wx.TOP | wx.LEFT | wx.BOTTOM, span=(1, 1))


    tc4 = wx.TextCtrl(panel, style=wx.TE_MULTILINE)
    self.boxsize.Add(tc4, pos=(11, 0), span=(4, 14), flag=wx.EXPAND, border=5)


    textclk = wx.StaticText(panel, -1,label = "发帖正文:", style=wx.ALIGN_LEFT | wx.ALIGN_CENTRE |wx.ALIGN_CENTRE_VERTICAL)
    font = wx.Font(22, wx.DEFAULT, wx.FONTSTYLE_NORMAL, wx.NORMAL, faceName="黑体")
    textclk.SetFont(font)
    textclk.SetForegroundColour("white")
    self.boxsize.Add(textclk, pos=(15, 0),flag=wx.TOP | wx.LEFT | wx.BOTTOM, span=(1, 1))


    self.tc4 = wx.TextCtrl(panel, style=wx.TE_MULTILINE)
    self.boxsize.Add(self.tc4, pos=(16, 0), span=(18, 14), flag=wx.EXPAND | wx.ALL, border=5)






    # self.fbb = wx.lib.filebrowsebutton.FileBrowseButton(panel,fileMode = wx.FD_OPEN,labelText="音乐:",size = (280,-1), buttonText= "Browse2",initialValue = r"E:\Doctor_Chen\wav1.wav", fileMask="*.wav",labelWidth = 10)
    # self.fbb.SetBackgroundColour("white")
    #
    #
    # self.play_button = wx.Button(panel, wx.ID_ANY, "播放")
    #
    # self.boxsize.Add(self.fbb, pos=(16, 0), span=(1, 3), flag=wx.EXPAND | wx.LEFT | wx.RIGHT, border=5)
    # self.boxsize.Add(self.play_button,pos=(16, 3) , flag=wx.EXPAND | wx.LEFT | wx.RIGHT, border=5)
    #
    # self.play_button.Bind(wx.EVT_BUTTON, self.onPlay)
    #
    #
    # self.play_button = wx.Button(panel, wx.ID_ANY, "暂停")
    # self.boxsize.Add(self.play_button,pos=(16, 4) , flag=wx.EXPAND | wx.LEFT | wx.RIGHT, border=5)
    #
    # self.type = ["单曲循环", "随机播放","循环播放"]
    # xxx = wx.ComboBox(panel, -1, "单曲循环", choices=self.type)
    # self.boxsize.Add(xxx, pos=(16, 5), span=(1, 1), flag=wx.EXPAND | wx.LEFT | wx.RIGHT, border=5)
    #
    # self.fbb = wx.lib.filebrowsebutton.FileBrowseButton(panel,fileMode = wx.FD_OPEN,labelText="保存:",size = (280,-1), buttonText= "Browse2",initialValue = r"E:\Doctor_Chen\wav1.wav", fileMask="*.wav",labelWidth = 10)
    # self.fbb.SetBackgroundColour("white")
    # self.boxsize.Add(self.fbb, pos=(17, 0), span=(1, 3), flag=wx.EXPAND | wx.LEFT | wx.RIGHT, border=5)
    #
    # self.play_button = wx.Button(panel, wx.ID_ANY, "录音")
    # self.boxsize.Add(self.play_button,pos=(17, 3) , flag=wx.EXPAND | wx.LEFT | wx.RIGHT, border=5)
    #
    #
    # self.play_button = wx.Button(panel, wx.ID_ANY, "暂停")
    # self.boxsize.Add(self.play_button,pos=(17, 4) , flag=wx.EXPAND | wx.LEFT | wx.RIGHT, border=5)
    #
    #
    # line = wx.StaticLine(panel)
    # self.boxsize.Add(line, pos=(18, 0), span=(1, 15), flag=wx.EXPAND | wx.BOTTOM | wx.TOP)


    panel.SetSizerAndFit(self.boxsize)

# def time_lock(self,event):
#     filename = self.text_alarm_p1.GetValue()
#     self.text_alarm_p1.SetLabel("111")
#     self.text_alarm_p1.SetBackgroundStyle(style=wx.TE_READONLY)

def Time(self, event):
    t1 = "当前时间: " + time.strftime("%H:%M:%S", time.localtime())
    self.text1.SetLabel(t1)
    for i in range(0, 24):
        temp = "{:0>2d}:00:00".format(i)
        # if t == temp:  # 判断是否为整点
        if t1 == "当前时间: " + self.text_alarm_p.GetValue():
            # filename = "E:\Doctor_Chen\00. YT\\" + "{:0>2d}.wav".format(i)  # 找到对应的wav文件路径
            filename = self.fbb.GetValue()
            self.Sound(filename)  # 播放声音
            break

def run(self, event):
    t1 = time.strftime("%H:%M:%S", time.localtime())
    self.text1.SetLabel(t1)
    # for i in range(0, 24):
    #     temp = "{:0>2d}:00:00".format(i)
        # if t == temp:  # 判断是否为整点
    # if t1 == self.text_alarm_p1.GetValue():
    content = self.tc4.GetValue()
    list = ["https://www.baidu.com/", "https://www.taobao.com/"]
    web.open(list[0])

    # driver = webdriver.Chrome(executable_path=r"D:\tools\python38\Scripts\chromedriver.exe")
    # driver.maximize_window()
    # driver.get(list[1])
    time.sleep(1)
    # driver.manage().window().maximize()

    # driver.execute_script("document.body.style.zoom='80%'")

    # time.sleep(2)
    # driver.close()

    # Window = windows_api()
    # Window.find_window_wildcard(".*淘宝.*")
    # Window.set_foreground()
    time.sleep(0.5)
    print(pyautogui.position())

    # driver.execute_script("document.body.style.zoom='100%'")
    #
    pyautogui.click(679, 348)
    pyperclip.copy(content)
    pyautogui.click(679, 348)
    pyautogui.hotkey("ctrl", "V")
    time.sleep(1)
    pyautogui.hotkey("enter")


def Sound(self, filename):
    f = wave.open(filename, 'rb')  # 加载音频文件(wav)
    pms = f.getparams()  # 获取音频的属性参数
    nchannels, sampwidth, framerate, nframes = pms[:4]  # 单独提取出各参数的值,并加以定义
    p = pyaudio.PyAudio()  # 创建一个播放器
    s = p.open(format=p.get_format_from_width(sampwidth), channels=nchannels, rate=framerate,
               output=True)  # 将音频转换为音频流
    while True:
        data = f.readframes(1024)  # 按照1024大小的块,读取音频数据,得到一系列二进制编码
        if data == b'':
            break
        s.write(data)  # 开始按照音频的参数,播放音频
    s.close()
    p.terminate()

# def alear_time(self):
#     for i in range(0, 24):
#         temp = "{:0>2d}:00:00".format(i)
#         # if t == temp:  # 判断是否为整点
#         if self.t == "当前时间: " + str(self.text_alarm_p.GetValue()):
#             # filename = "E:\Doctor_Chen\00. YT\\" + "{:0>2d}.wav".format(i)  # 找到对应的wav文件路径
#             filename = self.fbb.GetValue()
#             self.Sound(filename)  # 播放声音
#             break

def onPlay(self,event):
    self.text_alarm_p = wx.TextCtrl(self.panel, pos=(0, 0), style=wx.TE_READONLY)

class App(wx.App):

def OnInit(self):
    self.frame = MyCalculator()
    self.frame.Bind(wx.EVT_CLOSE, self.OnClose, self.frame)
    self.frame.Show()
    return True

# def OnOtherColor(self, event):
#     '''
#     使用颜色对话框
#     '''
#     dlg = wx.ColourDialog(self)
#     dlg.GetColourData().SetChooseFull(True)  # 创建颜色对象数据
#     if dlg.ShowModal() == wx.ID_OK:
#         self.paint.SetColor(dlg.GetColourData().GetColour())  # 根据选择设置画笔颜色
#     dlg.Destroy()

def OnClose(self, event):
    dlg = wx.MessageDialog(None, "是否要关闭窗口?", "请确认", wx.YES_NO | wx.ICON_QUESTION)
    retCode = dlg.ShowModal()
    if (retCode == wx.ID_YES):
        self.frame.Destroy()
    else:
        pass

if name == ‘main’:
app = App()
# job = Job(app)
# job.start()

app.MainLoop()

import wx
import math
import time
import pyaudio
import wave
import wx.lib.filebrowsebutton
from multiprocessing import Process
import threading

class Job(threading.Thread):

def __init__(self, *args, **kwargs):
    super(Job, self).__init__(*args, **kwargs)
    self.__flag = threading.Event()  # 用于暂停线程的标识
    self.__flag.set()  # 设置为True
    self.__running = threading.Event()  # 用于停止线程的标识
    self.__running.set()  # 将running设置为True

def run(self):
    while self.__running.isSet():
        self.__flag.wait()  # 为True时立即返回, 为False时阻塞直到内部的标识位为True后返回
        print(time.time())
        time.sleep(1)
        # print("sleep 1s")
def pause(self):
    self.__flag.clear()  # 设置为False, 让线程阻塞
    print("pause")
def resume(self):
    self.__flag.set()  # 设置为True, 让线程停止阻塞
    print("resume")
def stop(self):
    # self.__flag.set()  # 将线程从暂停状态恢复, 如果已经暂停的话(要是停止的话我就直接让他停止了,干嘛还要执行这一句语句啊,把这句注释了之后就没有滞后现象了。)
    self.__running.clear()  # 设置为False
    print("停止!")

class MyCalculator(wx.Frame):
def init(self):
super().init(parent=None, title=“多功能计算器”, size=(835, 1020),
style=wx.DEFAULT_FRAME_STYLE)
self.Center()
panel = wx.Panel(parent=self)
panel.SetBackgroundColour(‘grey’)
panel.Center()
font = wx.Font(16, wx.ROMAN, wx.NORMAL, wx.BOLD, underline=False)

    boxsize = wx.GridBagSizer(5,5)
    self.equation = ""
    self.result = 0
    self.ResultFlag = 0

    text = wx.StaticText(panel, -1,label = "常规计算", style=wx.ALIGN_LEFT)
    font1 = wx.Font(12, wx.ROMAN, wx.ITALIC, wx.NORMAL)
    txt = "常规计算"
    text.SetForegroundColour("white")
    text.SetBackgroundColour("black")
    font2 = wx.Font(18, wx.ROMAN, wx.ITALIC, wx.NORMAL)
    text.SetFont(font2)
    text.SetLabel(txt)
    boxsize.Add(text,pos=(0,0),span=(1,15))

    self.textprint = wx.TextCtrl(panel, pos=(0, 0))
    self.textprint.SetFont(font)  # 文本框里面格式
    self.textprint.BackgroundColour = 'red'
    boxsize.Add(self.textprint, pos=(1,0),span=(1,15),flag=wx.LEFT | wx.EXPAND)



    gridsizer = wx.GridSizer(cols=5, rows=6, vgap=1, hgap=1)
    for x in range(10):
        exec("self.btn%s = wx.Button(panel,label = '%s')" % (x, x))

    list = ['^', '.', '=', '÷', '×', '-', '+', 'Ans', 'AC', 'DEL', 'sin', 'cos', 'tan', '(', ')', 'π', 'log', 'ln',
            'sqrt', 'mod']
    for x in range(10, 30):
        exec("self.btn%s = wx.Button(panel,label = '%s')" % (x, list[x - 10]))

    for x in range(30):
        exec("self.btn%s.SetFont(font)" % (x))

    for i in range(0, 30):
        exec("self.btn%s.BackgroundColour = 'pale green'" % i)

    self.btn18.BackgroundColour = "red"

    list = []
    for i in range(0,30):
        exec("list.append((self.btn%s, 0, wx.EXPAND))"%i)
    print(list)
    gridsizer.AddMany(list)

    boxsize.Add(gridsizer,pos=(2, 0), span=(1, 15), flag=wx.EXPAND|wx.TOP|wx.LEFT|wx.RIGHT, border=1)

    line = wx.StaticLine(panel)
    boxsize.Add(line,pos=(3,0),span=(1,15),flag=wx.EXPAND|wx.BOTTOM|wx.TOP)

    text = wx.StaticText(panel, -1,label = "常规计算", style=wx.ALIGN_LEFT)
    font1 = wx.Font(12, wx.ROMAN, wx.ITALIC, wx.NORMAL)
    txt = "程序员计算"
    text.SetForegroundColour("white")
    text.SetBackgroundColour("black")
    font2 = wx.Font(18, wx.ROMAN, wx.ITALIC, wx.NORMAL)
    text.SetFont(font2)
    text.SetLabel(txt)
    boxsize.Add(text,pos=(4,0),span=(1,15))


    #
    # text2 = wx.StaticText(panel, label="程序员计算",style = 5, name = "1")
    # boxsize.Add(text2, pos=(3, 0), flag=wx.LEFT, border=10)

    line = wx.StaticLine(panel)
    boxsize.Add(line,pos=(5,0),span=(1,15),flag=wx.EXPAND|wx.BOTTOM|wx.TOP)

    self.textprint = wx.TextCtrl(panel, pos=(0, 0))
    self.textprint.SetFont(font)  # 文本框里面格式
    self.textprint.BackgroundColour = 'red'
    boxsize.Add(self.textprint, pos=(6,0),span=(1,15),flag=wx.LEFT | wx.EXPAND)


    gridsizer = wx.GridSizer(cols=16, rows=2, vgap=1, hgap=1)

    # tc1 = wx.TextCtrl(panel)
    # sizer.Add(tc1, pos=(2, 1), span=(1, 3), flag=wx.TOP | wx.EXPAND)
    #

    for x in range(32):
        exec("self.btn%s = wx.TextCtrl(panel,size=(5, 30))" % (x))
    for x in range(32):
        exec("self.btn%s.SetFont(font)" % (x))

    for i in range(32):
        exec("self.btn%s.BackgroundColour = 'white'" % i)

    list = []
    for i in range(0,32):
        exec("list.append((self.btn%s, 0, wx.EXPAND))"%i)
    print(list)
    gridsizer.AddMany(list)
    boxsize.Add(gridsizer,pos=(7, 0), span=(1, 15), flag=wx.EXPAND|wx.TOP|wx.LEFT|wx.RIGHT, border=1)


    text = wx.StaticText(panel, label='HEX:')
    text.SetForegroundColour("white")
    # text.SetBackgroundColour("black")
    font2 = wx.Font(18, wx.ROMAN, wx.ITALIC, wx.NORMAL)
    text.SetFont(font2)
    boxsize.Add(text, pos=(8, 0), flag=wx.TOP | wx.LEFT | wx.BOTTOM, border=5)

    tc = wx.TextCtrl(panel)
    boxsize.Add(tc, pos=(8, 1), span=(1, 4), flag=wx.EXPAND | wx.LEFT | wx.RIGHT, border=5)

    buttonOK = wx.Button(panel, label='左移:')
    # buttonOK.SetForegroundColour("white")
    # buttonOK.SetBackgroundColour("black")
    font2 = wx.Font(18, wx.ROMAN, wx.ITALIC, wx.NORMAL)
    buttonOK.SetFont(font2)
    boxsize.Add(buttonOK, pos=(8, 7), flag=wx.RIGHT | wx.BOTTOM, border=5)

    tc = wx.TextCtrl(panel)
    boxsize.Add(tc, pos=(8, 9), span=(1, 5), flag=wx.EXPAND | wx.LEFT | wx.RIGHT, border=5)


    text = wx.StaticText(panel, label='DEC:')
    text.SetForegroundColour("white")
    # text.SetBackgroundColour("black")
    font2 = wx.Font(18, wx.ROMAN, wx.ITALIC, wx.NORMAL)
    text.SetFont(font2)
    boxsize.Add(text, pos=(9, 0), flag=wx.TOP | wx.LEFT | wx.BOTTOM, border=5)

    tc = wx.TextCtrl(panel)
    boxsize.Add(tc, pos=(9, 1), span=(1, 4), flag=wx.EXPAND | wx.LEFT | wx.RIGHT, border=5)

    buttonOK = wx.Button(panel, label='右移:')
    # buttonOK.SetForegroundColour("white")
    # buttonOK.SetBackgroundColour("black")
    font2 = wx.Font(18, wx.ROMAN, wx.ITALIC, wx.NORMAL)
    buttonOK.SetFont(font2)
    boxsize.Add(buttonOK, pos=(9, 7), flag=wx.RIGHT | wx.BOTTOM, border=5)

    tc = wx.TextCtrl(panel)
    boxsize.Add(tc, pos=(9, 9), span=(1, 5), flag=wx.EXPAND | wx.LEFT | wx.RIGHT, border=5)


    text = wx.StaticText(panel, label='Yield[L:H]')
    text.SetForegroundColour("white")
    # text.SetBackgroundColour("black")
    font2 = wx.Font(18, wx.ROMAN, wx.ITALIC, wx.NORMAL)
    text.SetFont(font2)
    boxsize.Add(text, pos=(10, 0), flag=wx.TOP | wx.LEFT | wx.BOTTOM, border=5)


    tc = wx.TextCtrl(panel)
    boxsize.Add(tc, pos=(10, 1), span=(1, 1), flag=wx.EXPAND | wx.LEFT | wx.RIGHT, border=5)

    text = wx.StaticText(panel, label='  :')
    text.SetForegroundColour("white")
    # text.SetBackgroundColour("black")
    font2 = wx.Font(18, wx.ROMAN, wx.ITALIC, wx.NORMAL)
    text.SetFont(font2)
    boxsize.Add(text, pos=(10, 2), flag=wx.TOP | wx.LEFT | wx.BOTTOM, border=5)


    tc = wx.TextCtrl(panel)
    boxsize.Add(tc, pos=(10, 3), span=(1, 2), flag=wx.EXPAND | wx.LEFT | wx.RIGHT, border=5)

    buttonOK = wx.Button(panel, label='计算')
    # buttonOK.SetForegroundColour("white")
    # buttonOK.SetBackgroundColour("black")
    font2 = wx.Font(18, wx.ROMAN, wx.ITALIC, wx.NORMAL)
    buttonOK.SetFont(font2)
    boxsize.Add(buttonOK, pos=(10, 7), flag=wx.RIGHT | wx.BOTTOM, border=5)

    tc = wx.TextCtrl(panel)
    boxsize.Add(tc, pos=(10, 9), span=(1, 5), flag=wx.EXPAND | wx.LEFT | wx.RIGHT, border=5)


    line = wx.StaticLine(panel)
    boxsize.Add(line, pos=(11, 0), span=(1, 15), flag=wx.EXPAND | wx.BOTTOM | wx.TOP)

    text = wx.StaticText(panel, -1,label = "音乐和闹钟", style=wx.ALIGN_LEFT)
    font1 = wx.Font(12, wx.ROMAN, wx.ITALIC, wx.NORMAL)

    text.SetForegroundColour("white")
    text.SetBackgroundColour("black")
    font2 = wx.Font(18, wx.ROMAN, wx.ITALIC, wx.NORMAL)
    text.SetFont(font2)
    boxsize.Add(text, pos=(12, 0), span=(1, 15))

    line = wx.StaticLine(panel)
    boxsize.Add(line, pos=(13, 0), span=(1, 15), flag=wx.EXPAND | wx.BOTTOM | wx.TOP)

    t = time.strftime("%H:%M:%S", time.localtime())  # 设置初始值
    t = "当前时间:" + t
    self.text1 = wx.StaticText(panel, -1, t)
    font = wx.Font(22, wx.DEFAULT, wx.FONTSTYLE_NORMAL, wx.NORMAL, faceName="黑体")
    self.text1.SetFont(font)
    self.text1.SetForegroundColour("white")


    self.timer = wx.Timer(self)  # 创建一个计时器对象
    self.Bind(wx.EVT_TIMER, self.Time, self.timer)  # 绑定计时器事件
    self.timer.Start(1000)  # 计时器计时1秒

    boxsize.Add(self.text1, pos=(14, 0), span=(1, 2))



    buttonOK = wx.Button(panel, label="开始时间:")
    # buttonOK.SetForegroundColour("white")
    # buttonOK.SetBackgroundColour("black")
    font2 = wx.Font(18, wx.ROMAN, wx.ITALIC, wx.NORMAL)
    buttonOK.SetFont(font2)
    boxsize.Add(buttonOK, pos=(14, 2), flag=wx.RIGHT | wx.BOTTOM, border=5)


    self.text_alarm = wx.TextCtrl(panel, pos=(0, 0))
    self.text_alarm.SetFont(font)  # 文本框里面格式
    self.text_alarm.BackgroundColour = 'white'
    boxsize.Add(self.text_alarm, pos=(14,3),span=(1,1),flag=wx.EXPAND | wx.LEFT | wx.RIGHT, border=5)

    buttonOK = wx.Button(panel, label="倒计时:")
    # buttonOK.SetForegroundColour("white")
    # buttonOK.SetBackgroundColour("black")
    font2 = wx.Font(18, wx.ROMAN, wx.ITALIC, wx.NORMAL)
    buttonOK.SetFont(font2)
    boxsize.Add(buttonOK, pos=(14, 4), flag=wx.RIGHT | wx.BOTTOM, border=5)

    self.text_alarm = wx.TextCtrl(panel, pos=(0, 0))
    self.text_alarm.SetFont(font)  # 文本框里面格式
    self.text_alarm.BackgroundColour = 'white'
    boxsize.Add(self.text_alarm, pos=(14, 5), span=(1, 1), flag=wx.EXPAND | wx.LEFT | wx.RIGHT, border=5)


    textclk = wx.StaticText(panel, -1,label = "闹钟时间:", style=wx.ALIGN_LEFT | wx.ALIGN_CENTRE |wx.ALIGN_CENTRE_VERTICAL)
    font = wx.Font(22, wx.DEFAULT, wx.FONTSTYLE_NORMAL, wx.NORMAL, faceName="黑体")
    textclk.SetFont(font)
    textclk.SetForegroundColour("white")
    boxsize.Add(textclk, pos=(15, 0),flag=wx.TOP | wx.LEFT | wx.BOTTOM, span=(1, 1))

    self.text_alarm_p = wx.TextCtrl(panel, pos=(0, 0))
    self.text_alarm_p.SetFont(font)  # 文本框里面格式
    self.text_alarm_p.BackgroundColour = 'white'
    boxsize.Add(self.text_alarm_p, pos=(15,1),span=(1,1),flag=wx.EXPAND | wx.LEFT | wx.RIGHT, border=5)


    buttonOK = wx.Button(panel, label="结束时间:")
    # buttonOK.SetForegroundColour("white")
    # buttonOK.SetBackgroundColour("black")
    font2 = wx.Font(18, wx.ROMAN, wx.ITALIC, wx.NORMAL)
    buttonOK.SetFont(font2)
    boxsize.Add(buttonOK, pos=(15, 2), flag=wx.RIGHT | wx.BOTTOM, border=5)

    self.text_alarm = wx.TextCtrl(panel, pos=(0, 0))
    self.text_alarm.SetFont(font)  # 文本框里面格式
    self.text_alarm.BackgroundColour = 'white'
    boxsize.Add(self.text_alarm, pos=(15,3),span=(1,1),flag=wx.EXPAND | wx.LEFT | wx.RIGHT, border=5)

    textclk = wx.StaticText(panel, -1,label = "  用时:", style=wx.ALIGN_LEFT | wx.ALIGN_CENTRE |wx.ALIGN_CENTRE_VERTICAL)
    font = wx.Font(22, wx.DEFAULT, wx.FONTSTYLE_NORMAL, wx.NORMAL, faceName="黑体")
    textclk.SetFont(font)
    textclk.SetForegroundColour("white")
    boxsize.Add(textclk, pos=(15, 4),flag=wx.TOP | wx.LEFT | wx.BOTTOM, span=(1, 1))

    self.text_alarm = wx.TextCtrl(panel, pos=(0, 0))
    self.text_alarm.SetFont(font)  # 文本框里面格式
    self.text_alarm.BackgroundColour = 'white'
    boxsize.Add(self.text_alarm, pos=(15, 5), span=(1, 1), flag=wx.EXPAND | wx.LEFT | wx.RIGHT, border=5)


    self.fbb = wx.lib.filebrowsebutton.FileBrowseButton(panel,fileMode = wx.FD_OPEN,labelText="音乐:",size = (280,-1), buttonText= "Browse2",initialValue = r"E:\Doctor_Chen\wav1.wav", fileMask="*.wav",labelWidth = 10)
    self.fbb.SetBackgroundColour("white")


    self.play_button = wx.Button(panel, wx.ID_ANY, "播放")

    boxsize.Add(self.fbb, pos=(16, 0), span=(1, 3), flag=wx.EXPAND | wx.LEFT | wx.RIGHT, border=5)
    boxsize.Add(self.play_button,pos=(16, 3) , flag=wx.EXPAND | wx.LEFT | wx.RIGHT, border=5)

    self.play_button.Bind(wx.EVT_BUTTON, self.onPlay)


    self.play_button = wx.Button(panel, wx.ID_ANY, "暂停")
    boxsize.Add(self.play_button,pos=(16, 4) , flag=wx.EXPAND | wx.LEFT | wx.RIGHT, border=5)

    self.type = ["单曲循环", "随机播放","循环播放"]
    xxx = wx.ComboBox(panel, -1, "单曲循环", choices=self.type)
    boxsize.Add(xxx, pos=(16, 5), span=(1, 1), flag=wx.EXPAND | wx.LEFT | wx.RIGHT, border=5)

    self.fbb = wx.lib.filebrowsebutton.FileBrowseButton(panel,fileMode = wx.FD_OPEN,labelText="保存:",size = (280,-1), buttonText= "Browse2",initialValue = r"E:\Doctor_Chen\wav1.wav", fileMask="*.wav",labelWidth = 10)
    self.fbb.SetBackgroundColour("white")
    boxsize.Add(self.fbb, pos=(17, 0), span=(1, 3), flag=wx.EXPAND | wx.LEFT | wx.RIGHT, border=5)

    self.play_button = wx.Button(panel, wx.ID_ANY, "录音")
    boxsize.Add(self.play_button,pos=(17, 3) , flag=wx.EXPAND | wx.LEFT | wx.RIGHT, border=5)


    self.play_button = wx.Button(panel, wx.ID_ANY, "暂停")
    boxsize.Add(self.play_button,pos=(17, 4) , flag=wx.EXPAND | wx.LEFT | wx.RIGHT, border=5)


    line = wx.StaticLine(panel)
    boxsize.Add(line, pos=(18, 0), span=(1, 15), flag=wx.EXPAND | wx.BOTTOM | wx.TOP)

    text = wx.StaticText(panel, -1, label="陈依婷", style=wx.ALIGN_LEFT)
    font1 = wx.Font(12, wx.ROMAN, wx.ITALIC, wx.NORMAL)

    text.SetForegroundColour("white")
    text.SetBackgroundColour("black")
    font2 = wx.Font(18, wx.ROMAN, wx.ITALIC, wx.NORMAL)
    text.SetFont(font2)
    boxsize.Add(text, pos=(19, 0), span=(1, 15))

    line = wx.StaticLine(panel)
    boxsize.Add(line, pos=(20, 0), span=(1, 15), flag=wx.EXPAND | wx.BOTTOM | wx.TOP)

    image1 = wx.Image("1.jpg", wx.BITMAP_TYPE_JPEG).Rescale(620, 120).ConvertToBitmap()
    bmp1 = wx.StaticBitmap(panel, -1, image1)  # 转化为wx.Sta
    boxsize.Add(bmp1, pos=(21, 0),span=(12, 15), flag=wx.ALL, border=5)

    # # 向panel中添加图片
    # image = wx.Image("1.jpg", wx.BITMAP_TYPE_JPEG).ConvertToBitmap()
    # wx.StaticBitmap(panel, -1, bitmap=image, pos=(1, 825), size=(400, 200))

    # img = wx.Image("1.jpg",wx.BITMAP_TYPE_JPEG).ConvertToBitmap()
    # self.sBmp = wx.StaticBitmap(self, wx.ID_ANY, wx.BitmapFromImage(img))
    # # self.sBmp = wx.StaticBitmap(self, wx.ID_ANY, wx.BitmapFromImage(img))
    # boxsize.Add(self.sBmp, pos=(21, 0), proportion=0, flag=wx.ALL, border=10)

    # img = wx.Image(image, wx.BITMAP_TYPE_ANY)
    # self.sBmp = wx.StaticBitmap(self, wx.ID_ANY, wx.BitmapFromImage(img))
    #
    # sizer = wx.BoxSizer()
    # sizer.Add(item=self.sBmp, proportion=0, flag=wx.ALL, border=10)
    # self.SetBackgroundColour('green')
    # self.SetSizerAndFit(sizer)


    panel.SetSizerAndFit(boxsize)
    self.textprint.SetValue(self.equation)


def Time(self, event):
    t1 = "当前时间: " + time.strftime("%H:%M:%S", time.localtime())
    self.text1.SetLabel(t1)
    for i in range(0, 24):
        temp = "{:0>2d}:00:00".format(i)
        # if t == temp:  # 判断是否为整点
        if t1 == "当前时间: " + self.text_alarm_p.GetValue():
            # filename = "E:\Doctor_Chen\00. YT\\" + "{:0>2d}.wav".format(i)  # 找到对应的wav文件路径
            filename = self.fbb.GetValue()
            self.Sound(filename)  # 播放声音
            break

def Sound(self, filename):
    f = wave.open(filename, 'rb')  # 加载音频文件(wav)
    pms = f.getparams()  # 获取音频的属性参数
    nchannels, sampwidth, framerate, nframes = pms[:4]  # 单独提取出各参数的值,并加以定义
    p = pyaudio.PyAudio()  # 创建一个播放器
    s = p.open(format=p.get_format_from_width(sampwidth), channels=nchannels, rate=framerate,
               output=True)  # 将音频转换为音频流
    while True:
        data = f.readframes(1024)  # 按照1024大小的块,读取音频数据,得到一系列二进制编码
        if data == b'':
            break
        s.write(data)  # 开始按照音频的参数,播放音频
    s.close()
    p.terminate()

# def alear_time(self):
#     for i in range(0, 24):
#         temp = "{:0>2d}:00:00".format(i)
#         # if t == temp:  # 判断是否为整点
#         if self.t == "当前时间: " + str(self.text_alarm_p.GetValue()):
#             # filename = "E:\Doctor_Chen\00. YT\\" + "{:0>2d}.wav".format(i)  # 找到对应的wav文件路径
#             filename = self.fbb.GetValue()
#             self.Sound(filename)  # 播放声音
#             break

def onPlay(self,event):
    filename = self.fbb.GetValue()
    print(filename)
    self.Sound(filename)  # 播放声音

class App(wx.App):

def OnInit(self):
    self.frame = MyCalculator()
    self.frame.Bind(wx.EVT_CLOSE, self.OnClose, self.frame)
    self.frame.Show()
    return True

# def OnOtherColor(self, event):
#     '''
#     使用颜色对话框
#     '''
#     dlg = wx.ColourDialog(self)
#     dlg.GetColourData().SetChooseFull(True)  # 创建颜色对象数据
#     if dlg.ShowModal() == wx.ID_OK:
#         self.paint.SetColor(dlg.GetColourData().GetColour())  # 根据选择设置画笔颜色
#     dlg.Destroy()

def OnClose(self, event):
    dlg = wx.MessageDialog(None, "是否要关闭窗口?", "请确认", wx.YES_NO | wx.ICON_QUESTION)
    retCode = dlg.ShowModal()
    if (retCode == wx.ID_YES):
        self.frame.Destroy()
    else:
        pass

if name == ‘main’:
app = App()
# job = Job(app)
# job.start()

app.MainLoop()

import pyperclip
import pyautogui
import win32gui
import re
import win32con
import time
import webbrowser as web
from selenium import webdriver

class windows_api:
def init(self):
self._handle = None

def _windows_enum_callback(self,hwnd,wildcard):
    # win32gui.EnumWindows()
    if re.match(wildcard,str(win32gui.GetWindowText(hwnd))) != None:
        self._handle = hwnd

def find_window_wildcard(self,wildcard):
    self._handle = None
    win32gui.EnumWindows(self._windows_enum_callback,wildcard)

def set_foreground(self):
    done = False
    if self._handle > 0:
        win32gui.SetForegroundWindow(self._handle)
        win32gui.SendMessage(self._handle,win32con.WM_SYSCOMMAND,win32con.SC_MAXIMIZE,0)
        done = True
    return done

if name == “main”:
# Point(x=694, y=346) #百度框绝对坐标
# Point(x=800, y=195) #taobao
content = “篮球”
list = [“https://www.baidu.com/”,“https://www.taobao.com/”]
web.open(list[0])

# driver = webdriver.Chrome(executable_path=r"D:\tools\python38\Scripts\chromedriver.exe")
# driver.maximize_window()
# driver.get(list[1])
time.sleep(1)
# driver.manage().window().maximize()

# driver.execute_script("document.body.style.zoom='80%'")

# time.sleep(2)
# driver.close()


# Window = windows_api()
# Window.find_window_wildcard(".*淘宝.*")
# Window.set_foreground()
time.sleep(0.5)
print(pyautogui.position())

# driver.execute_script("document.body.style.zoom='100%'")
#
pyautogui.click(679,348)
pyperclip.copy(content)
pyautogui.click(679,348)
pyautogui.hotkey("ctrl","V")
time.sleep(1)
pyautogui.hotkey("enter")
# pyautogui.click(752,151)
# Point(x=1310, y=205)

-- coding: utf-8 -

import webbrowser as web
import time
import os

urllist=[
‘https://www.baidu.com/’,
‘https://www.csdn.net/’
]

我本地的chrome浏览器文职

chromepath = r’C:\Users\15420\AppData\Local\Google\Chrome\Application\chrome.exe’

# 注册浏览器对象

web.register(‘chrome’, None, web.BackgroundBrowser(chromepath))

# 打开浏览器

web.get(‘chrome’).open_new_tab(‘www.baidu.com’)

for j in range(0,6):#设置循环的总次数
i=0
while i<1 : #一次打开浏览器访问的循环次数
for url in urllist:
web.open(url) #访问网址地址,语法 .open(url,new=0,Autorasise=True),设置 new 的值不同有不同的效果0、1、2
i=i+1
time.sleep(2) #设置每次打开新页面的等待时间
else:

    time.sleep(5) #设置每次等待关闭浏览器的时间
    os.system('taskkill /IM chrome.exe')  #你设置的默认使用浏览器,其他的更换下就行

pip install Django==1.11.4 -i https://pypi.doubanio.com/simple

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值