【发布时间】:2022-01-02 16:44:20
【问题描述】:
我是一名新程序员,肯定有几个错误,但这应该不难发现。我需要创建一个简单的窗口,其中包含一个名为“Concorrente 1:”的字段和一个由名为 lacopertina() 的函数显示的输入字段。我不明白错误在哪里:
import tkinter as tk
from tkinter import *
from tkinter.ttk import *
from tkinter import ttk
class schermoiniziale(tk.Frame):
def lacopertina():
print(gio1)
#return (tot1)
def __init__(self):
global gio1
#tot1=0
#schermo1=Tk()
self.gio1=tk.StringVar()
lab1=ttk.Label(self, text="Concorrente 1:")
lab1.pack()
ent1=ttk.Entry(self, textvariable=self.gio1)
ent1.pack()
pulsante = ttk.Button(self, text="Inizio", textvariable=self.gio1, command=self.lacopertina)
pulsante.pack()
def main():
schermoiniziale().mainloop()
if __name__== "__main__":
main()
【问题讨论】:
-
错误是什么?您需要发布错误的完整回溯。