我不明白我的代碼有什么問題——它有我需要的一切,應該可以正常執行。
沒有產生錯誤,所以我認為這是一個邏輯錯誤,但我不知道如何修復它。
對此的幫助將不勝感激。
from tkinter import *
from tkinter import ttk
def Payment_Computation(self):
def Getting_Payment_in_Monthly():
def __init__(self):
uj5u.com熱心網友回復:
您缺少 oop 程式的一些重要部分:
from tkinter import *
from tkinter import ttk
class MainApplication(): # create class
def __init__(self):
# method code
def Payment_Computation(self):
# method code
def Getting_Payment_in_Monthly(self, Amount_Loan, mon_rate_interest, no_of_yrs):
# method code
if __name__ == "__main__":
MainApplication() # Instantiate class
您需要將代碼放在一個類中。然后,您需要實體化該類,如上例所示。
在構建 tkinter 應用程式的最佳方式中閱讀有關 oop 程式結構的更多資訊?
uj5u.com熱心網友回復:
你沒有呼叫這個__init__()函式。請仔細檢查:)
轉載請註明出處,本文鏈接:https://www.uj5u.com/yidong/465746.html
上一篇:截圖工具無法截取左側截圖
下一篇:breezypythonguiaddRadiobuttonGroup拋出意外的AttributeError:“str”物件沒有屬性“_root”
