2018-06-19 21:44:57

Hi, I am looking at possibly using wx python for a game that I am trying to build an interface for, but I would really like a specific kind of control. It doesn't have to be wx python, but I am most familiar with wx python and pygame. I am using python 3.4.

I want a control very similar to a listbox, but allows for left and right navigation similar to a table control. There are a few wx wigits that I have found such as ListCtrl using the report mode, or another similar control that I can't seem to find right now. The problem with these is that they are column oriented rather than row oriented. I don't care about the columns, I only care about the rows, which could be varying lengths.

To provide some context, I have a card game with many different zones, I want each zone to be a row in the list box, the zones obviously can have varying numbers of cards. I want to be able to navigate by each card in the zone by left and right errows, and to be able to move to the next zone using up and down errow. I will need to be able to add and remove items from each row easily, and a way to be able to pull up a context menu to show various operations for any given card.

A list box is almost what I want, but I can't find a way to override the keys for controlling the listbox so that the left and right erros could say navigate through an array of cards.

Does anyone have any idea on how to do this, or a different way of how to easily and quickly navigate through different card zones?

2018-06-19 21:54:22

Hi,

does this game (or whatever it is you're developing) need to be accessible for sighted players as well? Because in this case you'll probably need to do even more than just arrow keys support to make the cards clickable for sighted people too.
If yes, wxPython knows controls called Grids, which should be almost exactly what you want. You can e.g. place panels inside the grid slots which are then accessible using tab (or arrow keys, if handled correctly).
The other and more flexible solution would be to just use pygame. Pygame can handle key input directly so you can simulate almost everything you want, even though you'll need to take more care regarding edge cases.
Best Regards.
Hijacker

2018-06-19 22:19:37

hi.
you could create a menu class, which then can be simulated with an UI such as pyglet or pygame.

Paul

2018-06-19 23:49:44

Thanks for the responces. I don't care if the game is accessible to sighted individuals. I started using pygame, but I am having a couple problems with using pygame.

My first issue is that I am basicly going to be creating a GUI for the game, so using existing code already in wx python seems more advantageous. I could create all of my own controls in pygame by hand, but it seems redundant when almost all of the controls I need already exist in wx python. The only thing I need is this strange list box control.

My second problem is that I am having issues coming up with a good system for creating gui elements in pygame and handeling actions correctly. That could be a completely different thread though. I have started on building the system in pygame already, I am just hitting a wall in the basic design of the GUI system and so I started thinking about if I am over complicating the work I need to do, hence wx python.

The last thing is it would be nice if Jaws could work with my game as well. That is a small thing and less important, but by using pygame, I will need some kind of keyhook, which I did post in another thread, but I haven't seen any responces. WX python will allow for Jaws to work.

I will look into the wx grid, however, my intention is to have other controls on the window other than the grid, I want to be able to tab around through the controls.

2018-06-20 09:08:16

Hi,
yeah, so your only problem i'm seeing here is the JAWS accessibility, which shouldn't be a problem if you send it to sleep mode, but wait, JAWS doesn't read stuff anymore then right? Hm, so I guess this would need some handling, but doesn't sound impossible.
Well, I guess you're over-investing some thoughts here. When designing this interface for pygame, you don't need to think about it as an GUI (if its not for sighted people). Basically, what you need is:
* multiple different "controls", means input fields, menus, lists, whatever you like
* keys to cycle between them (tab, arrow up/down)
* you of course need to set up an efficient event-system to handle your controls and the interaction between them correctly
I already developed this myself and use it quite often in multiple python games, so I can at least tell you that it isn't impossible.
To wxPython: you're right, you already got all controls you need, the problem here is just about accessibility. Just because the control exists doesn't mean its accessible as well, and its pretty useless to use a control which works as you intend it to do, but can't be accessed by NVDA and JAWS.
OK, so to get a totally accessible solution which does exactly what you want it to do, without any fiddling around, pygame should be the best solution. If you want to use already existing things, but don't care about fiddling around hours and hours to get things working, wxPython is for you, and I know what i'm talking about, I lost hours of time trying to fix things with wxPython which needed so many rewrites of the whole interface again and again... I believe Qt is more elegant nowadays, but maybe wxPython 4.0 fixes those disapointments already, I just used wxPython 3 those days.
Best Regards.
Hijacker