Skip to content
Advertisement

Tag: events

What does ”event.pos[0]” mean in the pygame library? I saw an example using it to get the X axis of the cursor and ignore the Y axis

I don’t understand how it works. I don’t know if I understood the purpose of this function wrong. I tried to search what posx=event.pos[0] means but all I found was that if you want to take x, write the code of posx,posy=pygame.mouse.get_pos() and then take posx. But I still can’t understand the method he followed in the example I saw.

pywintypes.com_error: (-2147221008, ‘CoInitialize has not been called.’, None, None)

When I try to run this code as is I get this error “IDispatch = pythoncom.CoCreateInstance(IDispatch, None, clsctx, pythoncom.IID_IDispatch) pywintypes.com_error: (-2147221008, ‘CoInitialize has not been called.’, None, None)” , however if I run stp_tracker alone it works fine and if I run notify stp’s alone it works just fine. I appreciate anyones input. Thanks Answer Apologize for that, but searching

Wait for timeout or event being set for asyncio.Event

I have a class with a method that looks like this: The idea is that several of these are run in their own thread and at some point one thread does stop_event.set(), which naturally stops all others. I want to switch to asyncio for this, because the tasks in run are mostly sleeping and doing IO. Thus, I got to:

asyncio: Wait for event from other thread

I’m designing an application in Python which should access a machine to perform some (lengthy) tasks. The asyncio module seems to be a good choice for everything that is network-related, but now I need to access the serial port for one specific component. I’ve implemented kind of an abstraction layer for the actual serial port stuff, but can’t figure out

How can I fire a Traits static event notification on a List?

I am working through the traits presentation from PyCon 2010. At about 2:30:45 the presenter starts covering trait event notifications, which allow (among other things) the ability to automatically call a subroutine any time a trait has changed. I am running a modified copy of the example he gave… In this trial, I am trying to see whether I can

Advertisement