Thanks that fixed the problem!!!  I can't believe I didn't notice the over 
indentation.  

> On Mar 7, 2016, at 11:47 PM, claudio canepa <[email protected]> wrote:
> 
> The two mouse methods are over indented; they should be at the same level 
> than on_key_press.
> If you have mixed tab and spaces indentation, convert to spaces and then fix 
> indentation.
> You can use the python included editor IDLE to fix indentation (edit + select 
> all, edit + untabify region) 
> 
> 
>> On Tue, Mar 8, 2016 at 1:26 AM, Todd Rovito <[email protected]> wrote:
>> With the code below I am trying to setup a new pyglet window by inheriting 
>> but I can't get the mouse events to work, specifically on_mouse_press and 
>> on_mouse_motion.  Any help you can provide would be much appreciated, thanks!
>> 
>> from pyglet import image
>> from pyglet.gl import *
>> from pyglet.graphics import TextureGroup
>> from pyglet.window import key, mouse
>> 
>> TICKS_PER_SEC = 60
>> 
>> class Window(pyglet.window.Window):
>> 
>>     def __init__(self, *args, **kwargs):
>>         super(Window, self).__init__(*args, **kwargs)
>> 
>>         self.label = pyglet.text.Label('Hello, world',
>>                           font_name='Times New Roman',
>>                           font_size=36,
>>                           x=self.width//2, y=self.height//2,
>>                           anchor_x='center', anchor_y='center')
>>              self.set_mouse_visible(True)
>> 
>>     def on_key_press(self, symbol, modifiers):
>>      print 'A key was pressed'
>> 
>>      def on_mouse_press(self, x, y, button, modifiers):
>>              print ('mouse button press')
>>              if button == mouse.LEFT:
>>                      print 'The left mouse button was pressed.'
>> 
>>      def on_mouse_motion(self, x, y, dx, dy):
>>              print("mouse motion")
>> 
>>     def on_draw(self):
>>      self.clear()
>>      self.label.draw()
>> 
>> 
>> def main():
>>     window = Window(width=800, height=600, caption='Pyglet', resizable=True)
>>     # Hide the mouse cursor and prevent the mouse from leaving the window.
>>     #window.set_exclusive_mouse(True)
>>     #setup()
>>     pyglet.app.run()
>> 
>> if __name__ == '__main__':
>>     main()
>> 
>>  
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "pyglet-users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to [email protected].
>> To post to this group, send email to [email protected].
>> Visit this group at https://groups.google.com/group/pyglet-users.
>> For more options, visit https://groups.google.com/d/optout.
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "pyglet-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at https://groups.google.com/group/pyglet-users.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"pyglet-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/pyglet-users.
For more options, visit https://groups.google.com/d/optout.

Reply via email to