Is there a way to disable the window resizing in the Turtle module? E.G - Disable the maximize and minimize button and disable the ability to drag the window out or in. Thanks!
There's another way of doing it which is a little more 'hacky' but works well for projects that are already written using TurtleScreen
and not a RawTurtle
. It is actually a one-liner:
screen = turtle.Screen()
# ...
screen.cv._rootwindow.resizable(False, False)
This accesses the root window of the scrollable canvas object that turtle
creates and calls the resizable
method on it. This is not documented, though - so it might produce unexpected behavior.
As a general remark: Whenever you want to use functionality of tkinter
in a turtle
program and you cannot find a turtle
method for it - just check turtle
's sources, figure out how turtle
abstracts away the tkinter
object (like the canvas
in this case) and use the appropriate method on that object directly. Probably doesn't work all the time - but mostly you'll be able to achieve what you want.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With