Using Processing PGraphics in Python Mode?
问题 In Processing's Java Mode, you use PGraphics objects by declaring them globally, setting them up with createGraphics() in setup() and then referring to them in draw(). In the Python mode, what to do is not so clear and doesn't seem to be explained by the documentation. You can't declare variables in Python and variables are not automatically global, i.e. if I just say in setup() c = createGraphics(400,400) and then in draw() say c.beginDraw() I get a NameError: global name 'c' is not defined