Challenge 2 Write a function to draw a line and map it to a button
Underneath your code that creates your Turtle p=RawTurtle(s1)
but above TK.mainloop( )
create a function.
A function will only be run when it is called by another piece of code.
|#def defines a function fd10 is the name|
#p.fd(10) is code that will be run when
#this function is called by the button
Underneath the function but above TK.mainloop( ) create this button code
- Variable that button is created inside
- Makes the button on the TK canvas window
- Text to put on the the top of the button
- Tells the button to run the code inside function called fd10
- Places the button on the window
- Decides where it can be placed (top, bottom, right or left)
Save your code and test it