0
私はPythonと一般的なコーディングにはかなり新しいです。私はゲームのアプリケーションを作ろうとしており、私が作ったフレームを破壊するようには見えません。Python Tkinterフレームを破棄します
from tkinter import *
class application:
def __init__(self,parent):
self.startContainer = Frame(parent)
self.startContainer.pack()
self.lbl = Label(startContainer,text="Please choose from the following: \nFaith Points (F) \nBanqueting Goods (B) \nEnter Honour (E) ")
self.lbl.pack()
self.btn1 = Button(startContainer,text="Votes",command=self.votes(startContainer)).pack()
self.btn2 = Button(startContainer,text="Gold Tithe",command=self.gold(startContainer)).pack()
def votes(parent,self):
parent.destroy()
def gold(parent,self):
pass
window = Tk()
app = application(window)
window.title("Tools")
window.geometry("425x375")
window.wm_iconbitmap("logo.ico")
window.resizable(width=False, height=False)
window.mainloop()
、最初の引数は 'self'する必要がありません(自己、...)として、クラス内の関数のパラメータを構成してみてください。これはvoteとgoldのメソッドに適用されます。詳細については、この[link](http://stackoverflow.com/questions/2709821/what-is-the-purpose-of-self)を参照してください。 'self'の命名は単なる規約であり、予約語ではないことに注意してください。 – arrethra