0
我需要一些幫助將這個簡短程序製作成GUI。我希望它提示進入A點,然後繼續執行該程序。我只是困惑於如何用tkinter做到這一點。任何幫助表示讚賞提示輸入
import sys
while True:
num_sales=int(input("How many sales were completed? ")) # POINT A
while num_sales < 0:
print("Error. Number of sales cannot be less than 0.")
print("")
num_sales=int(input("How many sales were completed? "))
number = 0
total_sales = 0
while number < num_sales:
sale = float(input("Sale amount: "))
while sale < 0:
print("Error. The sale value cannot be less than 0.")
print("")
sale = float(input("Sale amount: "))
number += 1
total_sales += sale
print("The total sales are $",total_sales)
if total_sales < 10000:
commission = (8.2/100)*(total_sales)
print("Total commission is $",commission)
elif 10000 < total_sales < 25000:
commission = (17/100)*(total_sales)
print("Total commission is $",commission)
elif total_sales > 25000:
commission = (23.25/100)*(total_sales)
print("Total commission is $",commission)
else:
print("Unknown Error.")
sys.exit()
print("")
done = input("Are you finished running commissions? (Y/N) ")
if done == "Y":
sys.exit()
elif done == "y":
sys.exit()
print("")
WxWidgets也值得一提和指針:https://www.wxwidgets.org/ IMO WxWidgets的學習曲線比PyQt少得多,對初學者來說可能是更好的選擇。一旦你掌握了它,PyQt無疑更強大。 – nigel222
我總是發音爲「Teh-kin-ter」。 –