A grey 500×500 pixels display window (left) appears when you run your sketch. Better yet, use the associated keyboard shortcut: Ctrl+R for Windows and Linux or ⌘+R for Mac. You may also add other assets to your sketch folders, such as images and fonts – but more on that later. Within this are two files: hello_world.pyde and sketch.properties. You’ll notice that each sketch is saved as a new folder – in this case, a folder named “hello_world”. Using File > Save as… save the sketch (to wherever it’s you wish to store it) and name it “hello_world”. Type in the following lines of code: size ( 500, 500 ) print ( 'hello world' ) Create a new sketch by selecting File > New, or using the associated keyboard shortcut (which is listed alongside the menu entry). Given the visual and artistic nature of what you are likely to produce, it’s a fitting term. Processing refers to programs as “sketches”. Learning to write code may be the challenge you currently face, but as you grow more fluent, this will shift more towards mastering algorithmic thinking. Computers cannot make any assumptions and therefore require explicit and unambiguous direction, and this requires communicating in a language the machine understands – like Python. Should the sizes of the mugs vary, smaller ones would overflow and any requests for milk or extra sugar would be ignored. However, this set of steps would likely be insufficient for programming a coffee-making robot.
0 Comments
Leave a Reply. |