嘗試使用類創建GUI,並且一直存在此錯誤的問題。我不確定這是什麼意思,因爲我只有一個班就我所看到的,我的錯誤是:TypeError:元類衝突:派生類的元類必須是其所有基類元類的(非嚴格)子類
Traceback (most recent call last):
File "C:/Users/Blaine/Desktop/Computing Project.py", line 5, in <module>
class SneakerSeeker(tk,Frame):
TypeError: metaclass conflict: the metaclass of a derived class must be a
(non-strict) subclass of the metaclasses of all its bases
我的代碼是:
from tkinter import *
import tkinter as tk
import tkinter.messagebox as tm
class Number1(tk,Frame):
def __init__(self, master):
super(Number1, self).__init__()
self.master = master
self.frame = tk.Frame(self.master)
self.TopTitle = Label("Number1", font = ('Calibri ', 16))
self.TopTitle.pack()
def main():
root = tk.Tk()
root.title("Number 1")
app = Number1(root)
root.mainloop()
if __name__ == '__main__':
main()