雙色球第2023027期
第2023027期分析計(jì)算結(jié)果如下:
紅:2、9、10、11、15、17、22、27、29
藍(lán):5、10、11、15看好5
以下是幾個Python GUI程序設(shè)計(jì)的實(shí)例:
1.簡單計(jì)算器
import tkinter as tk
class Calculator:
? ? def __init__(self, master):
? ? ? ? self.master = master
? ? ? ? master.title("Calculator")
? ? ? ? self.display = tk.Entry(master, width=20, justify='right', font=('Arial', 16))
? ? ? ? self.display.grid(row=0, column=0, columnspan=4, padx=5, pady=5)
? ? ? ? button_text = ['7', '8', '9', '/',
? ? ? ? ? ? ? ? ? ? ? ?'4', '5', '6', '*',
? ? ? ? ? ? ? ? ? ? ? ?'1', '2', '3', '-',
? ? ? ? ? ? ? ? ? ? ? ?'0', '.', 'C', '+']
? ? ? ? r = 1
? ? ? ? c = 0
? ? ? ? for b in button_text:
? ? ? ? ? ? if b == 'C':
? ? ? ? ? ? ? ? tk.Button(master, text=b, width=5, height=2, command=lambda: self.clear()).grid(row=r, column=c, padx=2, pady=2)
? ? ? ? ? ? elif b == '+':
? ? ? ? ? ? ? ? tk.Button(master, text=b, width=5, height=2, command=lambda: self.add()).grid(row=r, column=c, padx=2, pady=2)
? ? ? ? ? ? elif b == '-':
? ? ? ? ? ? ? ? tk.Button(master, text=b, width=5, height=2, command=lambda: self.subtract()).grid(row=r, column=c, padx=2, pady=2)
? ? ? ? ? ? elif b == '*':
? ? ? ? ? ? ? ? tk.Button(master, text=b, width=5, height=2, command=lambda: self.multiply()).grid(row=r, column=c, padx=2, pady=2)
? ? ? ? ? ? elif b == '/':
? ? ? ? ? ? ? ? tk.Button(master, text=b, width=5, height=2, command=lambda: self.divide()).grid(row=r, column=c, padx=2, pady=2)
? ? ? ? ? ? else:
? ? ? ? ? ? ? ? tk.Button(master, text=b, width=5, height=2, command=lambda x=b: self.add_to_display(x)).grid(row=r, column=c, padx=2, pady=2)
? ? ? ? ? ? c += 1
? ? ? ? ? ? if c > 3:
? ? ? ? ? ? ? ? c = 0
? ? ? ? ? ? ? ? r += 1
? ? def add_to_display(self, text):
? ? ? ? self.display.insert(tk.END, text)
? ? def clear(self):
? ? ? ? self.display.delete(0, tk.END)
? ? def add(self):
? ? ? ? self.display.insert(tk.END, '+')
? ? def subtract(self):
? ? ? ? self.display.insert(tk.END, '-')
? ? def multiply(self):
? ? ? ? self.display.insert(tk.END, '*')
? ? def divide(self):
? ? ? ? self.display.insert(tk.END, '/')
root = tk.Tk()
calculator = Calculator(root)
root.mainloop()
本期精算結(jié)果如下:
紅:2、11、17、22、27、29
藍(lán):5
本文僅供學(xué)習(xí),感謝觀看