Is There A Way To Change The Location Of A Text Box In Turtle? It Always Shows Up In The Top Left For Me, But I Want It In The Bottom Center
import turtle screen = turtle.Screen() global answer answer = screen.textinput('Welcome to the game', 'What's your name?') Here is a screenshot of what comes up. I can't seem t
Solution 1:
The window with the input is made with tkinter. You can make your own function that makes it.
Here is a sample of your code:
import turtle
from tkinter import *
screen = turtle.Screen()
global answer
deftextinput(title, question):
message = Tk()
message.title(str(title))
message.geometry("350x200")
l = Label(message, text = str(question))
l.pack()#you can place it wherever you want
e = Entry(message)#customize all you want
e.pack()
defsubmit(event = "<Return>"):
global answer
answer = e.get()
message.destroy()
b = Button(message, text = "submit", command = submit)
b.pack()
b.bind_all("<Return>", submit)
message.mainloop()
answer = textinput("Welcome to the game", "What's your name?")
You can customize this window in any way. Like changing the button color, entry color, position, etc.
Hope this helps!!
Post a Comment for "Is There A Way To Change The Location Of A Text Box In Turtle? It Always Shows Up In The Top Left For Me, But I Want It In The Bottom Center"