Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #60731
| References | <7633df1c-5c4d-40ea-b9a5-51637d2fef89@googlegroups.com> |
|---|---|
| Date | 2013-11-29 07:50 +1100 |
| Subject | Re: Jython - Can't access enumerations? |
| From | Tim Delaney <timothy.c.delaney@gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.3377.1385671831.18130.python-list@python.org> (permalink) |
[Multipart message — attachments visible in raw view] - view raw
On 29 November 2013 04:22, Eamonn Rea <eamonnrea@gmail.com> wrote: > Hello! I'm using Jython to write a game with Python/Jython/LibGDX. I > wasn't having any trouble, and everything was going well, but sadly I can't > access items in enumerations. > > If you know about the LibGDX library and have used it, you'll probably > know about the BodyType enumeration for Box2D. I was trying to access the > BodyType item in the enumeration. This didn't work, as Jython couldn't find > the BodyType enumeration. I asked on the LibGDX forum and no one could > help. So I'm hoping that someone here could help :-) > > So, is this a problem with LibGDX or Jython? I'm using the latest version > of Jython. > There is no problems accessing the elements of enumerations with Jython. The following was tested using Jython 2.7b1: Jython 2.7b1 (default:ac42d59644e9, Feb 9 2013, 15:24:52) [Java HotSpot(TM) 64-Bit Server VM (Oracle Corporation)] on java1.7.0_40 Type "help", "copyright", "credits" or "license" for more information. >>> import java.util.Collections as Collections >>> import java.util.Arrays as Arrays >>> >>> a = Arrays.asList(1, 2, 3) >>> print(a) [1, 2, 3] >>> e = Collections.enumeration(a) >>> print(e) java.util.Collections$2@f48007e >>> >>> for i in e: ... print(i) ... 1 2 3 Therefore the problem is either with LibGDX or (more likely) way you are using it. Please post a minimal example that demonstrates the problem plus the exact error message you get (I don't know LibGLX at all, but someone else might, plus trimming it down to a minimal example may reveal the problem to you). Tim Delaney
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Jython - Can't access enumerations? Eamonn Rea <eamonnrea@gmail.com> - 2013-11-28 09:22 -0800
Re: Jython - Can't access enumerations? Tim Delaney <timothy.c.delaney@gmail.com> - 2013-11-29 07:50 +1100
Re: Jython - Can't access enumerations? Eamonn Rea <eamonnrea@gmail.com> - 2013-11-29 08:15 -0800
Re: Jython - Can't access enumerations? Tim Delaney <timothy.c.delaney@gmail.com> - 2013-11-30 06:40 +1100
csiph-web