简体   繁体   中英

My program is running, but it is minimized

def Poland():
    import turtle as t
    t.bgcolor("black")
    t.width(10)
    t.color("white")
    t.forward(50)
    t.right(90)
    t.penup()
    t.forward(10)
    t.right(90)
    t.pendown()
    t.color("red")
    t.forward(50)

Z = eval(input("Your country: "))
if (Z == Poland):
    Poland()

When I run this program and answer the question "Your country" with Poland, it does work (It opens "Python Turtle Graphics" window and draws a flag), but it is minimized. PLS help. I am new at this.

If you want to maximize the turtle window just use:

t.Screen().cv._rootwindow.wm_state("zoomed")

or

t.Screen().cv._rootwindow.state("zoomed")

This works because turtle is nothing other than tkinter window.

But the window will be played in the background.

To pop it up in the first layer:

t.Screen().cv._rootwindow.attributes("-topmost", True)

More tkinter in turtle t.Screen().cv._rootwindow.here_comes_the_tkinter_window_command

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM