資源簡介
Python開發計算器-多功能版,精簡版1.0可以進入我的主頁查找
代碼片段和文件信息
‘‘‘
Function:
tkinter計算器
Author:
Charlie
‘‘‘
import?math
import?tkinter
root?=?tkinter.Tk()
root.resizable(width=False?height=False)
‘‘‘hypeparameter‘‘‘
#?是否按下了運算符
IS_CALC?=?False
#?存儲數字
STORAGE?=?[]
#?顯示框最多顯示多少個字符
MAXSHOWLEN?=?18
#?當前顯示的數字
CurrentShow?=?tkinter.StringVar()
CurrentShow.set(‘0‘)
‘‘‘按下數字鍵(0-9)‘‘‘
def?pressNumber(number):
global?IS_CALC
if?IS_CALC:
CurrentShow.set(‘0‘)
IS_CALC?=?False
if?CurrentShow.get()?==?‘0‘:
CurrentShow.set(number)
else:
if?len(CurrentShow.get())? CurrentShow.set(CurrentShow.get()?+?number)
‘‘‘按下小數點‘‘‘
def?pressDP():
global?IS_CALC
if?IS_CALC:
CurrentShow.set(‘0‘)
IS_CALC?=?False
if?len(CurrentShow.get().split(‘.‘))?==?1:
if?len(CurrentShow.get())?
- 上一篇:python 極坐標圖
- 下一篇:pyqt5圖書管理系統源碼+安裝說明+數據庫
評論
共有 條評論