[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

RE:[pygame] GUI for pygame : ThorPy



Thanks for your comments.

Of course I agree with the fact that pygame community definitely needs a better way to communicate - at least a simple forum, for example. What could we do, concretely ?

In particular, it's a pity that we cannot benefit from the increasing popularity of python - a lot of schools and universities now introduce programming with python - and naturally, new python programmers interested in games and graphical applications would find pygame while typing for the first time "python game" on google.


==>Sam :

I think that I saw SGC a long time ago (maybe at that time it was not as much complete as now, and that explains why I decided to write my own). It seems to be quite complete from the point of view of the proposed widgets. In particular, it is well documented and seems easy to use with pre-existing projects, which is in my opinion a very important point (and I added a tutorial for this particular purpose on thorpy.org).
However, I think the following important elements are missing (tell me if I'm wrong):

- file browser
- draggable elements
- to propose a few default themes (by theme I do not only consider color and size, but all the graphical aspect) to the users. When someone wants to use a GUI for its game, this person expect at least to be able to set a 'modern' theme in no more than one line (for example, 'human'-like themes (Gnome-like buttons)). For example : http://www.thorpy.org/examples/submenus.png

Finally, for people who want it, it seems good to provides features that allow them to stay completely 'outside the event loop'. I mean something like what is shown here: http://www.thorpy.org/tutorials/reactions/step1const.html. Of course, for short codes, this feature does not seem important ; but for larger projects, it makes the code much, much shorter and clear in my opinion, by avoiding any ' if event == pygame.MOUSEBUTTONDOWN and event == blahblah' and saves a lot of time.

In the other hand, I can see many weaknesses of my library that SGC doesn't have - in particular, the JSON menu format of SGC sound very nice in comparison with 'element-per-element' menu building of ThorPy.
We could discuss a long time about what is important for a simple GUI, and to be honest I do not know SGC enough to speak about a lot of subjects : does it fully support semi-transparent widgets ? Can you 'unblit' widgets - on forums, I realized that many users who just came to pygame are looking for an 'unblit' function. It is difficult for them to code it, and I attached particular attention to the fact that user could want to draw anything of its own on GUI's elements, and so writing an efficient 'unblit' handler that take into account the fact that any widget can be transparent is not trivial. There is planty of these kind of things that I was not sure by looking at avalaible pygame GUI - and since I was learning python, I finally decided to write my library^^.

==>David :

Thank you for sharing your code. It's unfortunate that it does not appear on the pygame'gui page, as well as Albow, proposed by Greg. I just tried it under linux, with an old computer, and it seems very good and performant ! Of course, I will let you know if I need to re-use anything from your code :)



De : owner-pygame-users@xxxxxxxx [owner-pygame-users@xxxxxxxx] de la part de Michael Lutinsky [michael@xxxxxxxxxxxxxxxxxxxxxxxxx]
Envoyé : jeudi 25 juin 2015 12:02
À : pygame-users@xxxxxxxx
Objet : Re: [pygame] GUI for pygame : ThorPy

I looked over the ThorPy examples on your site and it was all very easy to understand. Kudos!

 

~ Michael

 


On Thu : Jun 25, 2015 5:58:33 AM you wrote:

> Hi Yann,

>

> I made one, too, a couple of years ago. Here it is:

> http://www.burtonsys.com/download/DavesGUI.zip

>

> It sounds like yours is probably more complete than mine, but if there's

> anything in mine which is useful to you, please feel free to plagiarize

> (per the notice in the comment block at the top of the main source file).

>

> The documentation is weak, though it does work with pydoc, and there are a

> lot of comments in the source code. The "demo" starts at line number 2730.

>

> To demo it, just unzip the files into a folder, and run DavesGUI.py -- then

> drag things around, click them, etc.

>

> (DavesGUIdemo1.py also runs, but it's an older & weaker demo; I just

> included it so that you can see an example of the "import" statements.)

>

> Prerequisites are Python 3.1 or later, or Python 2.6 or later 2.x, and

> pygame.

>

> A design goal was to make it easily "drop in" to existing pygame games,

> using the existing games' existing event loops. GUI elements ("widgets")

> are subclassed from pygame.sprite.Sprite, and user actions generate regular

> pygame events.

>

> A widget is a sprite that can receive pygame events via its notify()

> method. Unlike simpler sprites, some widgets can generate pygame events

> representing things like button or menu clicks, entered text, etc.

>

> Also, widgets can contain WidgetGroups of other widgets (as .children).

>

> I didn't really finish it, but I implemented simple and 3D buttons,

> checkboxes, vertical menus, single-line text-entry boxes, modal and

> non-modal message boxes, vertical and horizontal scroll bars, and forms.

> Forms can contain other widgets, including other forms, and they can be

> nested to arbitrary depth. Overlapping widgets are handled properly, as

> are dragging and resizing.

>

> As a favor to me, if you try it out or use it for anything, please take

> notes: a log of your frustrations, and what the documentation SHOULD HAVE

> told you, and what the code SHOULD HAVE done. As you accumulate such notes,

> please send them to me periodically.

>

> Best regards,

>

> Dave

>

>

>

> On Wed, Jun 24, 2015 at 6:16 PM, Yann Thorimbert <Yann.Thorimbert@xxxxxxxx>

> wrote:

>

> > Hi all,

> >

> > As many people did, I have been looking for a GUI for pygame. Naturally, I

> > have found this page : http://www.pygame.org/tags/gui . However, 'GUI's

> > there did not entirely fit my needs. I therefore wrote my own pygame GUI,

> > ThorPy, that I would like to share with other people.

> >

> > You can find it at http://www.thorpy.org. Any critics and remarks are

> > welcome.

> >

> > Also, I have another request : since I cannot sign up to pygame.org,

> > could someone add my library website to the ones on

> > http://www.pygame.org/tags/gui ? (I've been trying to subscribe to

> > pygame.org for weeks, with no success :( ) Thanks!

> >

> > Regards,

> >

> > Yann Thorimbert