Re: Problem with pyglet windows mouse event on_mouse_press

2018-03-07 Thread Daniel Gillet
Thanks everyone for reporting this annoying bug! I hope now it works for 
both exclusive and non-exclusive mode on Windows.

Cheers,
Dan

-- 
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 pyglet-users+unsubscr...@googlegroups.com.
To post to this group, send email to pyglet-users@googlegroups.com.
Visit this group at https://groups.google.com/group/pyglet-users.
For more options, visit https://groups.google.com/d/optout.


Re: Problem with pyglet windows mouse event on_mouse_press

2018-03-07 Thread Benjamin Moran
Thanks for the confirmation! 

Doug and Polorky, it would be great to know your results as well.


On Thursday, March 8, 2018 at 1:01:42 AM UTC+9, Joshua C wrote:
>
> Yes, this did it! (To add more info, I am running python 3.6.4 and pyglet 
> 1.3.1, forgot to mention that earlier)
>
>  I implemented the fixed __init___.py in pyglet/window/win32 and ran the 
> above test script. My application is now correctly detecting on_mouse_press 
> and on_mouse_release events.
>
> Thank you! (I'm not sure how to post this on the pull request)
>
> On Tuesday, March 6, 2018 at 8:59:46 PM UTC-8, Benjamin Moran wrote:
>>
>> Hi Joshua, 
>>
>> Yes, Dan was able to have a look at this recently. He has a pull request 
>> currently open, which would be great if you could try: 
>>
>> https://bitbucket.org/pyglet/pyglet/pull-requests/112/fix-bug-introduced-in-pr-104-commit/diff
>> If you try it, let us know your results either here or by comenting on 
>> his pull request. 
>>
>> -Ben
>>
>>
>> On Tuesday, March 6, 2018 at 11:28:17 PM UTC+9, Joshua C wrote:
>>>
>>> Hi Benjamin,
>>>
>>> Recently got back into Pyglet after noticing some updates (been a few 
>>> years). 
>>>
>>> Had this same issue as described above using the example code: all 
>>> events are being detected except on_mouse_press, 
>>> for all three of the main mouse buttons, and the two side buttons aren't 
>>> detected for any input at all.
>>> I am running Windows 10 Home, have an AMD FX-6350 processor, and a 
>>> wireless mouse, Logitech M510, 
>>> using whatever generic drivers come with Windows. I unfortunately cannot 
>>> test this issue on other hardware. 
>>> I poked around in Pyglet's source but I can't see anything obviously 
>>> wrong, so I am at a loss.
>>>
>>> Has any headway been made on this issue? Let me know if there is 
>>> anything I can do to help.
>>>
>>> Thank you!
>>>
>>> On Monday, February 19, 2018 at 6:12:54 PM UTC-8, Benjamin Moran wrote:

 Hi Polorky, 

 I wonder if this is related to this issue:  
 https://bitbucket.org/pyglet/pyglet/issues/130/mouse-release-event-not-triggered
 We thought that was a Mac only issue related to that specific touchpad, 
 but it's possible the issue lies elsewhere. 

 Interestingly, some people are reporting missing on_press, while others 
 are missing on_release events! 
 It shouldn't matter, but could you have a try with the exact code 
 example from the issue tracker, and confirm your results there? 
 Also, please share the hardware and OS details for your laptop. 

 Thanks!

 On Tuesday, February 20, 2018 at 4:46:25 AM UTC+9, Polorky wrote:
>
> Hi, I'm having the same issue. I have run the following code which 
> prints out all detectable Pyglet events:
>  
>
> screen.push_handlers(pyglet.window.event.WindowEventLogger())
>
>
> And this was the result:
>
> on_mouse_motion(x=442, y=371, dx=0, dy=-1)
> on_draw()
> on_mouse_release(x=442, y=371, button='LEFT', modifiers=MOD_NUMLOCK)
> on_draw()
> on_mouse_release(x=442, y=371, button='LEFT', modifiers=MOD_NUMLOCK)
> on_draw()
> on_mouse_motion(x=445, y=374, dx=3, dy=3)
>
>
> I clicked the mouse twice but it only read the 'release' not the 
> 'press'.
>
> I'm using a Windows laptop and I've tried this with the mouse pad and 
> an external mouse, neither is working.
>
> Any ideas?
>


-- 
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 pyglet-users+unsubscr...@googlegroups.com.
To post to this group, send email to pyglet-users@googlegroups.com.
Visit this group at https://groups.google.com/group/pyglet-users.
For more options, visit https://groups.google.com/d/optout.


Re: Midi Visualizer

2018-03-07 Thread Benjamin Moran
As a quick followup, I found my Midi keyboard, and tried some things. 
I had good luck with the `rtmidi` module:   
https://pypi.python.org/pypi/python-rtmidi

It's pretty easy to open up a midi device, and create a callback for key 
presses. Instead of using the "on_key_press" events in pyglet, you can use 
the rtmidi callback to set the characters. You will need to determine what 
the midi data actually means, and create some kind of mapping. A dictionary 
will work well for that. 

import time
import rtmidi


midi_in = rtmidi.MidiIn()

available_ports = midi_in.get_ports()
print(available_ports)

# I have a USB midi keyboard, and device #2 is the input:
port = midi_in.open_port(2)


def printer(message, data):
# Actually update something here
print(message, data)


port.set_callback(printer, data=None)

while True:
# Dumb event loop
time.sleep(1)








On Wednesday, March 7, 2018 at 2:34:34 PM UTC+9, Benjamin Moran wrote:
>
> Hi Eelke, 
>
> Sorry, I've been very busy the last week.  It seems like you're making 
> good progress! Not bad for your first project. 
>
> *In answer to your previous questions:*
> In simple terms, the on_draw method is called whenever you press a key or 
> resize the window.  This is an "event driven" programming style, and it 
> works well for GUI applications. After all, the screen does not need to be 
> updated if nothing changes. 
> For more graphical applications, such as games, you want a steady update 
> (such as 60fps). To do that, just use the `pyglet.clock.schedule_interval` 
> function. This will cause the window to be redrawn as necessary. 
>
> For graphical effects, you could do it with Sprites. You could also do it 
> with OpenGL shaders, but it will require some knowledge of shader 
> programming. I would recommend you skip this step for now, and come back to 
> it after the functionality is more complete. 
>
> For reading your physical Midi device, it seems that `mido` is popular 
> these days. Mido uses the rtmidi or portmidi backends. It will require you 
> to install that library as well.
> As a first step, I would try to create a small program that will read your 
> keyboard, and print your key presses out to the console. After you have 
> that working, it should be pretty easy to implement it into your pyglet 
> project.
>
> I think I have an old Midi keyboard laying around. I might give it a try 
> as well. 
>
>
> On Monday, March 5, 2018 at 2:42:48 PM UTC+9, Eelke Johnson wrote:
>>
>>
>> 
>> Hi community,
>>
>> I updated my small project. I reviewed how my code works and I 
>> implemented chord lines between notes.
>>
>> Now, I need your suggestions :)
>> I want to improve the visual part with a glow effect when a note is 
>> played like in the software synthétisa. have you any idea how to implement 
>> it?  I listen to your commentaries and if you have another good idea I take 
>> it!
>>
>> My second challenge is to implement it with my midi keyboard. There isn't 
>> many documentation available online. Do you have any ressources for a 
>> pyglet program who use midi input?
>>
>> Thank you for your support :D I'm proud of the result and I hope I can 
>> keep it moving straight forward !
>>
>> Eelke (way2key)
>>
>

-- 
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 pyglet-users+unsubscr...@googlegroups.com.
To post to this group, send email to pyglet-users@googlegroups.com.
Visit this group at https://groups.google.com/group/pyglet-users.
For more options, visit https://groups.google.com/d/optout.