Search code examples
pythonminimized

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.


Solution

  • 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