【问题标题】:how to change the position of textinput in python/turtle如何在 python/turtle 中更改文本输入的位置
【发布时间】:2019-03-20 05:03:04
【问题描述】:
#welcome Player 1 and print the players name

player1 = sc.textinput("Name of Player X", "Whats your name? ")
movingTurtle.penup()
movingTurtle.goto(-275, 240)
movingTurtle.pendown()
sc.wel_Player1 = movingTurtle.write("Welcome Player X: "+player1, 
font=FONT2)

这段代码运行良好,一个小“消息框”弹出并询问第一个玩家他的名字——问题是我不能改变那个文本框的位置——我什至不知道,如果可以的话

【问题讨论】:

    标签: python-3.x turtle-graphics textinput python-turtle


    【解决方案1】:

    我也有同样的问题,我到处寻找答案!

    不幸的是,根据我的发现,没有似乎有任何方法可以修改文本输入框的位置或整体外观。

    看看->This similar post

    这可能就是你要找的。​​em>

    如果有人可以真正提出不同的方法,那将不胜感激,但是我的结论是文本输入对话框不能可悲地修改。 em>

    我所做的是通过在其后面添加一个黑色 backdrop-type 框并使其更加明显和专业。

    #the black backdrop
    useroptionboxback = turtle.Turtle()
    useroptionboxback.speed(0)
    useroptionboxback.shapesize(stretch_wid=6.8,stretch_len=10)
    useroptionboxback.shape('square')
    useroptionboxback.color('black')
    useroptionboxback.penup()
    useroptionboxback.goto(-215,255)
    useroptionboxback.direction = 'stop'
    
    #the tetinput box
    title1 = 'Menu'
    prompt1 = 'Please type a number.'
    useroptionbox = turtle.textinput(title1, prompt1)
    wn.update()
    

    Example Screenshot 如果您发现链接上的人所说的内容过于混乱,我建议您这样做。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-03-11
      • 2014-06-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多