From: brian z. <bz...@zi...> - 2001-10-29 22:20:56
|
If you have a PyObject and want to get the underlying Java instance, use: po.__tojava__(<the Java class you want>) For instance, say arg is a PyInteger instance, the following would get the long value: long ticks = ((Number) arg.__tojava__(Number.class)).longValue(); Most subclasses (maybe all) of PyObject implement this method and try their best to give you what you want. It's amazing thorough for most types. brian ----- Original Message ----- From: "Sells, Fred" <fr...@ad...> To: "Jython (E-mail)" <jyt...@li...> Sent: Monday, October 29, 2001 3:15 PM Subject: [Jython-users] casting a java object created in jython to its true class > I use exec() in java to run some Python that defines gui elements. > > I would like to get specific elements by name. > > I can get do PyObject po = Python.get("xyz") > > but I cannot cast this to anything but java.lang.Object > > what am I missing here???? > > tia > > fred > > > _______________________________________________ > Jython-users mailing list > Jyt...@li... > https://lists.sourceforge.net/lists/listinfo/jython-users |