Search Results

Search found 2 results on 1 pages for 'amorack'.

Page 1/1 | 1 

  • "TypeError: draw() takes exactly 1 non-keyword argument (3 given)"

    - by Amorack
    I wrote this code to open a window with Pyglet in Python... import pyglet from pyglet import window class Window(pyglet.window.Window): def __init__(self): super(Window, self).__init__() myLabel = pyglet.text.Label("Prototype") windowText = myLabel.draw(Window, "Hello World", font_name = "Times New Roman", font_size = 36, color = (193, 205, 193, 255)) def on_draw(self): self.clear() self.label.draw() if __name__ == '__main__': window = Window() pyglet.app.run() however every time I run it I get this error: TypeError: draw() takes exactly 1 non-keyword argument (3 given) AFAIK the "(3 given)" means the problem is with the font_size or color arguments but I'm not sure. Could someone explain what's wrong and help me make this work?

    Read the article

  • Python "draw() must be called with Label instance as first argument (got _WindowMetaclass instance i

    - by Amorack
    This is a class I made using Python with pyglet to display a window. class Window(pyglet.window.Window): def __init__(self): super(Window, self).__init__() pyglet.text.Label("Prototype") windowText = text.Label.draw(Window, "Hello World", font_name = "Times New Roman", font_size = 36, color = (193, 205, 193, 255)) def on_draw(self): self.clear() self.label.draw() Every time I try to run it I get the error "TypeError: unbound method draw() must be called with Label instance as first argument (got _WindowMetaclass instance instead)". I'm pretty sure I know what I have to do (find how to get Label's instance) just not how to do it. Could someone help me understand how to make this work?

    Read the article

1