体彩python_【Python】体育彩票选号器

这个程序是一个基于Python的体育彩票选号器,利用Tkinter库创建GUI界面。用户可以选择手动输入号码或让程序随机生成号码。程序还显示当前时间和预计的开奖时间,并能保存已选号码。用户可以选择号码是否允许重复,点击开始按钮启动选号,结果会显示在文本框中。
摘要由CSDN通过智能技术生成

from tkinter import *

importtkinter.ttk as tkimportdatetimefrom tkinter.messagebox import *

importtkinter.font as tfimporttimeimportrandomimportthreadingclassSportslottery(Tk):def __init__(self):

super().__init__()

self.title("体育彩票选号器")

self.geometry("800x600+170+80")

self.resizable(0, 0)

self.iconbitmap(R"C:\Users\Administrator\PycharmProjects\untitled1\GUI_体育彩票选号器\photo\easyicon_net_64.ico")

self["bg"] = "lightblue"

#全局变量

self.number_list = [] #存储选票号码的每一个值

self.input_datas_list = [] #存储多次输入的每一组7位数字

self.number_list01 = [0,1,2,3,4,5,6,7,8,9] #用于允许重复获取数字的列表的前6位

self.number_list02 = [0,1,2,3,4] #用于允许重复获取数字的列表的第7位

self.ready = 0 #启动默认标识符

#自动加载界面

self.SetupUI()defSetupUI(self):#设置Style

self.style01 =tk.Style()

self.style01.configure("title.TLabel",foreground = "RoyalBlue")

self.style01.configure("TPanedwindow", foreground="RoyalBlue")

self.style01.configure("label02.TLabel", foreground="blue")

self.style01.configure("label03.TLabel", foreground="red")

self.style01.configure("label04.TLabel", foreground="blue")

self.style01.configure("TButton", foreground="black")#加载窗体图片

self.load_img = PhotoImage(file=R"C:\Users\Administrator\PycharmProjects\untitled1\GUI_体育彩票选号器\photo\beijingtu.png")

self.label_img= tk.Label(self,image=self.load_img)

self.label_img.place(x=0,y=0)#设置title

self.label01 = tk.Label(self,text ="6 + 1 体育彩票选号器",style="title.TLabel",font = ("微软雅黑",30,"bold"))

self.label01.place(x=180,y =20)

self.labelFrame_query01= tk.LabelFrame(self,width =380,height = 60)

self.labelFrame_query01.place(x=0,y=100)

self.labelFrame_query02= tk.LabelFrame(self,width =370,height = 60)

self.labelFrame_query02.place(x=420,y=100)

self.labelFrame_query03= tk.LabelFrame(self,text="人选",width =410,height = 60)

self.labelFrame_query03.place(x=380,y=200)

self.labelFrame_query04= tk.LabelFrame(self,text="机选",width =410,height = 260)

self.labelFrame_query04.place(x=380,y=280)#加载系统时间

defget_week_day(date):""":param date: 生成中文的星期

:return:"""week_day_dict={

0:'星期一',1: '星期二',2: '星期三',3: '星期四',4: '星期五',5: '星期六',6: '星期天',

}

day=date.weekday()returnweek_day_dict[day]

current_week=get_week_day(datetime.datetime.now())#时间格式处理

date01 =datetime.datetime.today()

current_d

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值