Re: [pygame] Error pygame with timidity.cfg

2018-04-21 Thread Martin Kühne
Neither timidity nor any of its configuration is parsed or otherwise
referenced by the pygame source. Please justify what your need is
here.

cheers!
mar77i


Re: [pygame] Error pygame with timidity.cfg

2018-04-20 Thread Martin Kühne
Line 30, according to https://i.imgur.com/efCVxHg.png was the
soundfont path, btw.

cheers!
mar77i


Re: [pygame] Error pygame with timidity.cfg

2018-04-20 Thread Martin Kühne
On Fri, Apr 20, 2018 at 4:57 PM,   wrote:
> Can anyone help me!?

1. Okay I get it. You had a problem and asked in the wrong place. We
assumed you'd ask in a better place eventually, that's why nobody
responded.
2. Pygame-users is really the wrong list for your problem, you need to
look for support with timiditiy.
3. The error message is clear in that there was an "Error with opening
file". How about if you check whether it's in the expected place and
whether the user running it may read it?
4. The path in your config is spelled the same way as the path in the
wiki I'm comparing it to. Look for trailing whitespace in your config,
maybe?

a) Really make sure that the soundfont is where you're trying to load
it from and that your user may in fact read it.
b) consider looking at your configuration with a hex editor.
c) consider running timidity it in a debugging tool such as `strace`
so you can see what file is *actually* attempted to be opened.

cheers!
mar77i


Re: [pygame] pygame awesome libraries?

2018-04-05 Thread Martin Kühne
On Thu, Apr 5, 2018 at 2:40 PM, Yann Thorimbert
 wrote:
> Not exactly awesome,


Come again? What ridiculous standard are you assuming there for "awesome"?

cheers!
mar77i


Re: [pygame] Opening Python project in PyCharm - Mac

2018-02-07 Thread Martin Kühne
As a heavy command line user, pycharm opens source files in an
existing editor window when I type `pycharm source.py`.

cheers!
mar77i


Re: [pygame] Line Collision

2017-11-18 Thread Martin Kühne
A central key in the whole task is gaining good control over which of
>, <, <=, >= you need to use to compare different intervals, so to say
whether either first's bottom is lower than second's top value or
whether first's top is lower than second's bottom value. But this kind
of interval comparison is only possible when you, as the second
exercise, are able to boil the problem down to actual interval
comparisons.

As I don't know how much linear algebra you need to catch up on here,
please ask away for any furhter clarification, maybe I or even
somebody else in this channel is able to take you through the task
from where you stand in a more specific manner.

cheers!
mar77i


Re: [pygame] Line Collision

2017-11-18 Thread Martin Kühne
think about it this way:

if the line is fully left, fully right, fully above or fully beneath
the rectangle, it's not close to the rectangle.

to find the closest approach to the rectangle you usually equate the
rectangle's border lines with the line to be compared as a function:

with exception of vertical lines, a line always has a "rise", that is
a number of y pixels for any x pixel crossing the x axis at a vertical
offset, mathematically that's the classically linear function
expressed with f(x): y = ax + b. Equating that with the lowest and
highest x coordinates of the rectangle gives you two equations y = a *
left + b and y = a * right + b which, when solved for y can then be
compared with the rect's top and bottom coordinate. the rectangle is
obviously crossed if one of the variables is inside the vertical
interval or if they are on opposite sides of the vertical interval; in
code, that's roughly summarized with the following if line:

if ((a * left + b) < bottom and (a * right + b) > bottom) or ((a *
left + b) > top and (a * right + b) < top)):

Welcome to the world of linear algebra. from here onwards you only
need to get used to it enough to figure the case of a vertical line
too.

cheers!
mar77i


Re: [pygame] How to prevent mouse initialization in Pygame

2017-07-17 Thread Martin Kühne
What's your status about the `tty` group membership?

cheers!
mar77i


Fwd: [pygame] How to prevent mouse initialization in Pygame

2017-07-13 Thread Martin Kühne
Sorry everyone for the confusion, as was mentioned, two of my previous
emails was sent off-list for whatever reason.
I read up on the topic arriving at the SE thread that was linked
before [0] and tried to figure out the problem based on the work with
strace, which I commended as very through and well-conceived. I also
asked Roman to tell me whether group membership in `tty` would help,
which own the files in /dev on my system. Also Roman, please note that
many ioctls return data in pointers that can be passed to them which
should be the spot where your results actually differ.

cheers!
mar77i

[0] 
https://unix.stackexchange.com/questions/117981/what-are-the-responsibilities-of-each-pseudo-terminal-pty-component-software.


Re: [pygame] How to prevent mouse initialization in Pygame

2017-07-07 Thread Martin Kühne
> I already changed permissions for the limited user (pi) according to this 
> instruction: How do I let an SDL app (not running as root) use the console, 
> but to no avail :(

I just wanted to suggest you make sure permissions in /dev are
granted, but you appear to have arrived at that conclusion yourself.
Of course now you have to figure out which device is being opened
unsuccessfully. /dev/console only applies to text i/o and not
framebuffer and graphics. /dev/fb0 maybe? Maybe use strace instead?

cheers!
mar77i


Re: [pygame] take screenshots of desktop and any app running (even with direct3d, opengl, sdl, ...)

2017-06-20 Thread Martin Kühne
There appears to be a glReadPixels(0, 0, width, height, GL_RGB,
GL_UNSIGNED_BYTE, pixels) function for that purpose in the OpenGL C
library, maybe pyopengl has an equivalent function?

cheers!
mar77i


Re: [pygame] Why does Rect and Surface have copy method when copy exist in std-lib?

2017-06-04 Thread Martin Kühne
What we've established so far:

- copy.copy is considered an import "hurdle"
- which is why many modules implement a .copy() function to
- both of which basically wrap an internal .__copy__() function whose
direct use appears to be discouraged

At the end of the day I think you should decide what your code needs
to do: if copying an object or resource is a natural thing to do you
want to provide for your users, implement a __copy__ function. Adding
a line copy = __copy__ underneath would hence be a good thing to do to
encourage and ease use. In some cases, a copy of an object may be
nontrivial to create or, for example with system resource you rather
want to not provide anything like it, don't provide __copy__ and skip
this part.

cheers!
mar77i


Re: [pygame] Re: Pygame doesn't close properly so I can't delete the file it's using

2017-05-28 Thread Martin Kühne
Looks like stackoverflow is slowly choking on OP.

cheers!
mar77i

[0] 
https://stackoverflow.com/questions/44221985/attributeerror-imageext-when-trying-to-reload-module-pygame
[1] 
https://stackoverflow.com/questions/44218304/pygame-doesnt-close-an-mp3-file-the-second-time-it-uses-it?rq=1
[2] 
https://stackoverflow.com/questions/44219509/pygame-doesnt-close-properly-so-i-cant-delete-the-file-its-using?rq=1


Re: [pygame] Re: Pygame doesn't close properly so I can't delete the file it's using

2017-05-28 Thread Martin Kühne
Please regard distinct issues as distinct.

Yes, opened.close() is the right thing to do as far as opening and
closing files goes.

I think the del pygame.imageext exception is an accident, since
actually, pygame should catch AtrributeError there.

As for the PermissionError; are you sure you didn't have the file open
in another program?
Focus on that part, since the rest is happening accidentally.

cheers!
mar77i


Re: [pygame] Re: Blit method bug?

2017-05-25 Thread Martin Kühne
On Thu, May 25, 2017 at 6:54 PM, babaliaris  wrote:
> Thank's both of you! I didn't know that pygame uses 16 bits integers (I
> thought it was 32 bits every integer i put in the blit coordinates).
>

How comes you'd think such a thing? Python itself already ships
variable sized integers and keeps track of their size...

> I already thought to blit only images which the rectangle of it is at least
> inside the screen resolution.
> (Excuse me for my english).
>

Read my email again. I think I covered that already [0].

cheers!
mar77i

[0] https://www.pygame.org/docs/ref/rect.html#pygame.Rect.colliderect


Re: [pygame] Blit method bug?

2017-05-25 Thread Martin Kühne
On Thu, May 25, 2017 at 1:06 PM, babaliaris  wrote:
> Hello!
>
> i have a problem with blit. When i try to blit a lot of images using a for
> loop (for example 800) after a certain amount, the blit is messing up the
> drawing.
>
> See the following video i made:  Blit Problem Video
> 
>
> You can clearly see all my code in the video.
>
> Can anyone tell me if this is a bug or if not, what is the problem?
>


Let's be generous and say that this is not a bug, but rather a
technical limitation. Obviously pygame uses 16 bit integers for
coordinates internally, so that when you use coordinates higher than
65535, they wrap around to 0 again.
The question is, whether silly input values deserve silly output.
Personally, I see nothing wrong with that. I'm not sure you even could
attach more than 4 4k screens in a row to a modern computer, but that
would only amount to maximally quarter of the 65536 line which you
crossed in your video.

You can make sure that is the case by passing sensible values to your
blit function. For example, you could not blit at all if the
coordinates are outside the screen rectangle with the following
addition (to replace the blit line you already have):

image_pos = (x + i, y + i)
if screen.get_rect().colliderect(pygame.Rect(image_pos, image.get_size())):
screen.blit(image, image_pos)

cheers!
mar77i


Re: [pygame] pygamezero moving to github discussion thread

2017-03-16 Thread Martin Kühne
how about gitlab or cgit? it would be cool if site users could use
pygame's resident gitlab with the same credentials. I'm not sure how
far it's possible to set this up though.

cheers!
mar77i


Re: [pygame] https://pygame.org/

2017-03-10 Thread Martin Kühne
A sigh of relief. GJ! :-D

cheers!
mar77i


Re: [pygame] unsubscribe

2017-01-09 Thread Martin Kühne
the email link on the website points to the following url:
mailto:majord...@seul.org?body=unsubscribe%20pygame-users

Better luck next time, I guess?

cheers!
mar77i


Re: [pygame] Unsubscribe

2017-01-06 Thread Martin Kühne
the email link on the website points to the following url:
mailto:majord...@seul.org?body=unsubscribe%20pygame-users

Better luck next time, I guess?

cheers!
mar77i


Re: [pygame] New pygame.org website

2016-12-24 Thread Martin Kühne
On Fri, Dec 23, 2016 at 10:46 PM, Radomir Dopieralski
 wrote:
> Please, no Angular, no leftpad.js, no client-side use-all-cpu
> works-only-in-my-favorite-browser unusable disabled-hostile confusing
> shiny technologies. That's exactly how the current website was created.
>
> There is already a perfectly good way of searching a static web page,
> without any processing on the server, built into your browser -- you can
> access it with ctrl+f.

I like your ideas. For cross-site search, maybe something simple
resembling python's site serach (which appears to work on my ofline
copy) could later be considered.

cheers!
mar77i


Re: [pygame] BUG: pygame leaks memory (?)

2016-12-20 Thread Martin Kühne
Use timers so you don't run on 100% CPU:

TIMER = pygame.NUMEVENT - 1
pygame.time.set_timer(TIMER, 50)

def show(self):
# this is a simple frame dropping logic, so that the event queue
empties per call of show()
# and within the time specified by pygame.time.set_timer
updated=False
for event in [pygame.event.wait(), *pygame.event.get()]:
if event.type == QUIT:
exit()
elif event.type == TIMER and not updated:
updated = True
# update graphic here
pygame.display.update()


I do find it surprising that pygame should be creating a memory leak
in this case, since none of the pygame functions you use,
pygame.event.get, pygame.Surface.fill, pygame.draw.rect are ones which
one would expect to permanently allocate memory for any obvious
reason.

cheers!
mar77i


Re: [pygame] Pygame 1.9.2 release candidate

2016-12-09 Thread Martin Kühne
On Sat, Dec 10, 2016 at 12:00 AM, Thomas Kluyver  wrote:
> - Is this a regression relative to a version of pygame you were using
> before? If something has been broken recently, it's more important to fix
> that before a release than something that's a longstanding annoyance.

As far as I remember, sdl has had various deficiencies regarding
fullscreen for ever. I think I once resigned over the fact that sdl
seemingly has no way whatsoever to handle differently sized/oriented
monitors in conjunction with FULLSCREEN. Reading up on the topic
online, it is suggested that the behavior will even vary across
operating systems and window managers.

Basically, I doubt the problem is a regression. Furthermore, I
strongly believe that no cause for the problem can be found anywhere
in pygame's source code. At most, we might consider reflecting
FULLSCREEN_DESKTOP in the Surface module.

cheers!
mar77i


Re: [pygame] Out of memory loading very large image

2016-09-29 Thread Martin Kühne
On Thu, Sep 29, 2016 at 10:54 AM, shortcipher
 wrote:
> I get "pygame.error Out of memory" on pygame.image.load() of a 55.1 MB JPG
> with 41141 x 3317 pixels.
> What is the biggest image pygame can load?
> Is there any way of allocating more memory so that this image can be loaded?
>

That's a 520 megabytes bitmap, that should not be too bad? The problem
is probably whatever limitations apply to the allocator your jpeg
library uses.
Maybe memory fragmentation might be an issue? How much memory do you
have spare, when running the program?

cheers!
mar77i


Re: [pygame] Installing pygame with pip

2016-09-28 Thread Martin Kühne
Do you run the setup.py as your user? You may be in a virtual
environment or have a different configuration in your .local/ path?
Maybe setuptools somehow decides to use a different pip/python
version/whatvever? Thomas, you seem to miss that from your last mail?


cheers!
mar77i


Re: [pygame] Installing pygame with pip

2016-09-28 Thread Martin Kühne
For me, it's spelled 'Pygame', not 'pygame'. And pip offers v1.9.2b8
of that one.

cheers!
mar77i


Re: [pygame] Installing pygame with pip

2016-09-28 Thread Martin Kühne
What version do you get when you install pygame from pip?


Re: [pygame] Installing pygame with pip

2016-09-28 Thread Martin Kühne
I meant the paragraph beneath the one that made you write yet another mail.
I'll go ahead and quote it for you:

> We are pretty close to having 'pip install pygame' working on the three
> major platforms - it should already work today for Linux and Windows, but
> there are still a couple of hiccups to be sorted out on OSX.

cheers!
mar77i


Re: [pygame][website] A different approach to a new website

2016-09-19 Thread Martin Kühne
That being said, I want in no way defend the current site's design. I
probably find it just as bad as the next guy, although with a big
screen I think I'd nearly be able to navigate it. I merely pointed out
that not everyone has the same need for a good-looking and
well-structured pygame website.

cheers!
mar77i


Re: [pygame][website] A different approach to a new website

2016-09-19 Thread Martin Kühne
On Mon, Sep 19, 2016 at 11:04 AM, Alex Z.  wrote:
> Hi, I'm Alex.

Hi Alex

> And until today I still remember how I saw the website and I thought that it
> was just a little students project that couldn't really do much,
> as I needed like an eternity to find the download package I needed, not to
> speak about finding a good tutorial.
>

With many operating systems these days, pygame is just a "repository
package". I know Microsoft Windows is kind of an exception in these
regards, but I really encourage you to use one which... is built to
serve your own interests.

With this topic out of the way, open up a terminal, fire up a python
shell and you can discover all of pygame by typing "import pygame" and
using help() and dir(). If you build pygame from source you also have
the option to generate the whole of the pygame documentation locally
which also saves you internet traffic. That can be used in better ways
indeed. This might sound a bit condescending, but explaining how to
get along with an open source project in a general sense is not
something that pygame needs to deliver. Making your bed is a good
start for sleeping well in it.

cheers!
mar77i


[pygame] Re: ev.__dict__ does not include ev.type?

2016-08-18 Thread Martin Kühne
Acutally, disregard this whole thread. I found a viable solution
around getattr() [0].

cheers!
mar77i

[0] 
https://github.com/mar77i/pygametower/commit/758ecee24abf9baf134a3aea0c47ec8a4c6fffb9


[pygame] Re: ev.__dict__ does not include ev.type?

2016-08-18 Thread Martin Kühne
Correction, I got the use of dict_from_event wrong, as it's only
referenced in PyEvent_new().
I hence rather suggest making event.dict a callable, which copies the
internal dict and adds the type as an additional item. And I would not
mind to implement it, too.

cheers!
mar77i


[pygame] ev.__dict__ does not include ev.type?

2016-08-18 Thread Martin Kühne
Hello list,

I have another minor gripe to report. Building my general input
decorator pattern [0] was fun, but as I started using it, I noticed
that ev.__dict__ doesn't add the type of the event to the dictionary.
Incidentally, though, that is the most significant designator for
event filters. So I just build a complete dictionary using that 3.5
syntax again [1], which is awkward. Attached is a patch which would
just represent all of the event's data in the resulting dict.

cheers!
mar77i

[0] https://github.com/mar77i/pygametower/blob/master/util.py#L25
[1] https://github.com/mar77i/pygametower/blob/master/tower.py#L77
From ff1960affaea9ebfe6303e5f7ffc7b6b0241f6f9 Mon Sep 17 00:00:00 2001
From: mar77i 
Date: Thu, 18 Aug 2016 14:08:24 +0200
Subject: [PATCH] add event type to pygame.Event.{dict,__dict__} objects

---
 src/event.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/event.c b/src/event.c
index eb3d8e7..0854312 100644
--- a/src/event.c
+++ b/src/event.c
@@ -259,6 +259,7 @@ dict_from_event (SDL_Event* event)
 
 if (!(dict = PyDict_New ()))
 return NULL;
+insobj (dict, "type", PyInt_FromLong (event->type));
 switch (event->type)
 {
 case SDL_ACTIVEEVENT:
-- 
2.9.3



[pygame] [RFC] pygame.event.wait_get()

2016-08-17 Thread Martin Kühne
I noticed another pattern I seem to consistently apply to all event
code I write.
Namely that I want to process all events during one iteration of the
main loop, but wait .
Up until recently I had used pygame.event.get() without noticing that
that essentially is a busy wait and hence migrated to the less nicely
looking

while running:
  for ev in [pygame.event.wait(), *pygame.event.get()]:
if ev.type == ...

The patch is attached from my local git(-hub) clone and would allow to
rephrase the above to the now equivalent

while running:
  for ev in pygame.event.wait_get():
if ev.type == ...

cheers!
mar77i
From ec5173d91442ddf00518b2b4b8685452ae6518d2 Mon Sep 17 00:00:00 2001
From: mar77i 
Date: Wed, 17 Aug 2016 12:39:25 +0200
Subject: [PATCH] add pygame.{fast,}event.wait_get() -> Eventlist combines
 pygame.wait() with pygame.get() as a pre-3.5 shortcut for
 [pygame.event.wait(), *pygame.event.get()] as basis for limiting one
 iteration over the main loop per frame and one frame per iteration over the
 main loop.

---
 docs/reST/ref/event.rst | 12 
 src/doc/event_doc.h |  6 ++
 src/event.c | 23 +++
 src/fastevent.c | 29 +
 4 files changed, 70 insertions(+)

diff --git a/docs/reST/ref/event.rst b/docs/reST/ref/event.rst
index 2633ec9..a5f7c61 100644
--- a/docs/reST/ref/event.rst
+++ b/docs/reST/ref/event.rst
@@ -151,6 +151,18 @@ type and have identical attribute values. Inequality checks also work.
 
.. ## pygame.event.wait ##
 
+.. function:: wait_get
+
+   | :sl:`wait for at least one event and get events from the queue`
+   | :sg:`wait_get() -> Eventlist`
+
+   This will get all the messages and remove them from the queue. If the queue
+   is empty this function will wait until one is created. While the program is
+   waiting it will sleep in an idle state. This is important for programs that
+   want to share the system with other applications.
+
+   .. ## pygame.event.wait_get ##
+
 .. function:: peek
 
| :sl:`test if event types are waiting on the queue`
diff --git a/src/doc/event_doc.h b/src/doc/event_doc.h
index c936f49..705dca1 100644
--- a/src/doc/event_doc.h
+++ b/src/doc/event_doc.h
@@ -9,6 +9,8 @@
 
 #define DOC_PYGAMEEVENTWAIT "wait() -> EventType instance\nwait for a single event from the queue"
 
+#define DOC_PYGAMEEVENTWAITGET "wait_get() -> Eventlist\nwait for at least one event and get all events from the queue"
+
 #define DOC_PYGAMEEVENTPEEK "peek(type) -> bool\npeek(typelist) -> bool\ntest if event types are waiting on the queue"
 
 #define DOC_PYGAMEEVENTCLEAR "clear() -> None\nclear(type) -> None\nclear(typelist) -> None\nremove all events from the queue"
@@ -62,6 +64,10 @@ pygame.event.wait
  wait() -> EventType instance
 wait for a single event from the queue
 
+pygame.event.wait_get
+ wait_get() -> Eventlist
+wait for at least one event and get all events from the queue
+
 pygame.event.peek
  peek(type) -> bool
  peek(typelist) -> bool
diff --git a/src/event.c b/src/event.c
index 74dd7ab..eb3d8e7 100644
--- a/src/event.c
+++ b/src/event.c
@@ -683,6 +683,23 @@ pygame_wait (PyObject* self, PyObject* args)
 }
 
 static PyObject*
+pygame_wait_get (PyObject* self, PyObject* args)
+{
+int status;
+
+VIDEO_INIT_CHECK ();
+
+Py_BEGIN_ALLOW_THREADS;
+status = SDL_WaitEvent (NULL);
+Py_END_ALLOW_THREADS;
+
+if (!status)
+return RAISE (PyExc_SDLError, SDL_GetError ());
+
+return event_get (self, args);
+}
+
+static PyObject*
 pygame_poll (PyObject* self, PyObject* args)
 {
 SDL_Event event;
@@ -1014,6 +1031,12 @@ static PyMethodDef _event_methods[] =
 
 { "pump", (PyCFunction) pygame_pump, METH_NOARGS, DOC_PYGAMEEVENTPUMP },
 { "wait", (PyCFunction) pygame_wait, METH_NOARGS, DOC_PYGAMEEVENTWAIT },
+{
+"wait_get",
+(PyCFunction) pygame_wait_get,
+METH_NOARGS,
+DOC_PYGAMEEVENTWAITGET
+	},
 { "poll", (PyCFunction) pygame_poll, METH_NOARGS, DOC_PYGAMEEVENTPOLL },
 { "clear", event_clear, METH_VARARGS, DOC_PYGAMEEVENTCLEAR },
 { "get", event_get, METH_VARARGS, DOC_PYGAMEEVENTGET },
diff --git a/src/fastevent.c b/src/fastevent.c
index e54393a..9db4198 100644
--- a/src/fastevent.c
+++ b/src/fastevent.c
@@ -130,6 +130,34 @@ fastevent_wait (PyObject * self)
 return PyEvent_New ();
 }
 
+/* DOC */ static char doc_wait_get[] =
+/* DOC */ "pygame.fastevent.wait_get() -> list of Events\n"
+/* DOC */ "wait for at least one event and get all events from the queue\n"
+/* DOC */ "\n"
+/* DOC */ "Returns all events from the queue. If there are no messages\n"
+/* DOC */ "waiting on the queue, this will not return until at least one is\n"
+/* DOC */ "available. Sometimes it is important to use this wait to get\n"
+/* DOC */ "events from the queue, it will allow your application to idle\n"
+/* DOC */ "when the user isn't doing anything with it.\n"
+/* DOC */ ;
+static PyObject *