locked
Turtle Graphics in Small basic with variables RRS feed

  • Question

  • Im trying to get a text window that allows input for color and shape. i want to have pre set shapes i make ( im drawing a house) but i want the user to be able to pick what color the house is drawn in the shapes would be the same every time just want to be able to change the color that the turtle draws with. 

    TextWindow.Write ("Select Color For your house: Red Green Blue ")
    TextWindow.Read()
    red =GraphicsWindow.GetColorFromRGB (255 0 0)
    green = GraphicsWindow.GetColorFromRGB (0 255 0)
    blue = GraphicsWindow.GetColorFromRGB (0 0 255)

    Wednesday, September 17, 2014 6:55 AM

Answers

  • You should assign the result of TextWindow.Read() to a variable:   col=Textwindow.Read()

    Then you can assign the color to the pen:  GraphicsWindow.PenColor=col

    After that the turtle draws with that color.


    Jan [ WhTurner ] The Netherlands


    • Edited by WhTurner33Editor Wednesday, September 17, 2014 9:14 AM typo
    • Proposed as answer by Nonki Takahashi Wednesday, September 17, 2014 9:38 AM
    • Marked as answer by illium1121 Thursday, September 18, 2014 12:59 AM
    Wednesday, September 17, 2014 9:13 AM
    Answerer

All replies

  • You should assign the result of TextWindow.Read() to a variable:   col=Textwindow.Read()

    Then you can assign the color to the pen:  GraphicsWindow.PenColor=col

    After that the turtle draws with that color.


    Jan [ WhTurner ] The Netherlands


    • Edited by WhTurner33Editor Wednesday, September 17, 2014 9:14 AM typo
    • Proposed as answer by Nonki Takahashi Wednesday, September 17, 2014 9:38 AM
    • Marked as answer by illium1121 Thursday, September 18, 2014 12:59 AM
    Wednesday, September 17, 2014 9:13 AM
    Answerer
  • Thank you sooooo Much!?!?!?
    Thursday, September 18, 2014 12:15 AM