0
私の宿題では、ウィジェットを作成する必要があります。私はこれに非常に新しいです。私は私のボタンを表示しようとしています。私はそれらを梱包しようとしましたが、私は何が間違っているのか分かりません。ここに私が持っているものがあります。まず、あなたのインデントのGUI、ウィンドウにボタンが表示されない
from tkinter import *
import turtle
main = Tk()
main.title("TurtleApp")
class turtleApp:
def __init_(self):
self.main = main
self.step = 10
self.turtle = turtle.Turtle()
self.window = turtle.Screen()
self.createDirectionPad
def createDirectionPad(self):
mainFrame = Frame(main)
mainFrame.pack()
button1 = Button(mainFrame,text = "left", fg="red")
button2 = Button(mainFrame,text = "right", fg="red")
button3 = Button(mainFrame,text = "up", fg="red")
button4= Button(mainFrame,text = "down", fg="red")
button1.pack()
button2.pack()
button3.pack()
button4.pack()
main.mainloop()
インスタンスを作成したあと、まだ実行されていません。 – Mia
@Mia上記の – Suever
を更新しました。コードを投稿した後、それを見て修正しました。どうやら、私のコードには私が見ていない別の問題があります。 – Mia