Neil Wallace | 1 Sep 10:19
Picon

Re: Where best to find documentation?

Morning Greg, Kenneth,

Am I write in thinking that we Jython users are mainly a sub-group of
Python users?
If so, I wonder what can be done to attract Java hackers over.

Perhaps the wiki could occasionally diverger into two sections? Jython
docs for Java guys & Jython docs for  Python Guys?

Neil.

--
please ignore the following crap, which has been appended by Micro$oft 
without my permission.

_________________________________________________________________
Can you see your house from the sky? Try Live Search Maps 
http://maps.live.com

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
Kenneth McDonald | 1 Sep 11:23
Picon
Favicon

Re: Where best to find documentation?

At the moment, I'd guess that Jython users are a (small) sub-group of 
Python hackers,
i.e. not users but rather the subgroup who both use and really enjoy 
playing with Python.
This is an unfortunate consequence of the fact that Jython went dormant 
for such a long time;
there's going to be a certain hesitancy about Jython until people 
believe it's here to stay.
I myself confess to using JRuby at the moment, though I'd (probably) 
prefer Jython, which
is why I'm looking at it :-).

IMHO, for Jython (or any Java scripting language) to work in the long 
term, it needs to satisfy
the fact that Java is in use in a more heavy-duty factory-line sort of 
environment than Python;
I think a much higher percentage of Java users just want to get the job 
done, as opposed to
a larger percentage of Pythonistas who also enjoy playing with tech. 
This makes sense--who'd
think that playing with tech was fun if you had to program Java all day?

To work with that sort of mind set, Jython needs several things.

1) It should be easy to set up and to start to do simple things with. So 
far, so good.

2) It needs to be really, really solid, both with respect to correctness 
and (to a useful level)
completeness in its interoperability with Java. I don't know what 
(Continue reading)

NISHIO Hirokazu | 1 Sep 15:24

Jython2.2 has problem on hadling MIDI?

Hi, I'm Nishio. I'm writing Jython book in Japanese.
I tried my snippets for Jython2.1 and found a problem.
The following code work well on Jython2.1 (make sound via MIDI),
but I run it on Jython2.2 it doesn't work (no errors but no sounds)

I wonder it is Jython2.2's bug or just depends on my environments.
Could you tell me the code works or not?

>>> from javax.sound.midi import MidiSystem as MS
>>> s = MS.getSynthesizer()
>>> s.open()
>>> c = s.getChannels()[0]
>>> c.noteOn(50, 127)

If it make sound, you can stop it with following code
>>> c.noteOff(50)

sincerely

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
Alan Kennedy | 1 Sep 17:13
Favicon

Re: Jython2.2 has problem on hadling MIDI?

[NISHIO]
> Could you tell me the code works or not?

>>>>from javax.sound.midi import MidiSystem as MS
>>>>s = MS.getSynthesizer()
>>>>s.open()
>>>>c = s.getChannels()[0]
>>>>c.noteOn(50, 127)

Works fine for me on both jython 2.1 and jython 2.2, i.e. it produces 
sound when run on both.

Jython 2.2 on java1.4.2_15
Type "copyright", "credits" or "license" for more information.
 >>> from javax.sound.midi import MidiSystem as MS
 >>> s = MS.getSynthesizer()
 >>> s.open()
 >>> c = s.getChannels()[0]
 >>> c.noteOn(50, 127)
[Sound from speaker]
 >>> c.noteOff(50)
[Sound stops]

Regards,

Alan.

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
(Continue reading)

cyberco | 1 Sep 22:58
Favicon

pass a double vs int as an keyword argument

First: As a long time java and python user I can't begin to say how I enjoyed discovering jython over the last week. Thanks to everyone here that made my 'java life' productive and fun again!

My issue:

A JSplitPane has the following 2 methods  
 
'setDividerLocation(int pixels)' 
'setDividerLocation(double percentage)' 
 
I want to invoke the latter but: 
 
'split = JSplitPane(dividerLocation=java.lang.Double(0.25))' 
 
throws an exception: 
 
'can't convert 0.25 to int' 
 
Why does Jython try to convert the double to an int?  
So I try: 
 
split.setDividerLocation(java.lang.Double(0.25)) 
 
which doesn't throw an exception (but doesn't seem to work either). 
 
Is there a workaround?

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
Jython-users mailing list
Jython-users <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jython-users
Charlie Groves | 1 Sep 23:35
Picon
Gravatar

Re: pass a double vs int as an keyword argument

On 9/1/07, cyberco <cyberco <at> media2b.net> wrote:
> My issue:
>
>  A JSplitPane has the following 2 methods
>
>  'setDividerLocation(int pixels)'
>  'setDividerLocation(double percentage)'
>
>  I want to invoke the latter but:
>
>  'split = JSplitPane(dividerLocation=java.lang.Double(0.25))'
>
>  throws an exception:
>
>  'can't convert 0.25 to int'
>
>  Why does Jython try to convert the double to an int?

I'm not quite sure why it picks the int version to call when you pass
it an object, but if you just pass 0.25 directly it finds the right
method.

JSplitPane(dividerLocation=0.25) or jsp.setDividerLocation(0.25) will
do what you want.

Charlie

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
Kenneth McDonald | 2 Sep 06:31
Picon
Favicon

How big is the current Jython dev team?

I just noticed on Sourceforge that there are 18 people (mostly 
developers) registered as being active on Jython, and am wondering if 
that's accurate in terms of current, active developers.

Thanks,
Ken

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
cyberco | 2 Sep 14:00
Favicon

Re: pass a double vs int as an keyword argument

Unfortunately not, 'JSplitPane(dividerLocation=0.25)' throws:

TypeError: can't convert 0.25 to int

Berco


On 9/1/07, Charlie Groves <charlie.groves <at> gmail.com> wrote:

if you just pass 0.25 directly it finds the right
method.

JSplitPane(dividerLocation=0.25) or jsp.setDividerLocation(0.25) will
do what you want.

Charlie

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
Jython-users mailing list
Jython-users <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jython-users
Frank Wierzbicki | 2 Sep 14:22
Picon
Gravatar

Re: How big is the current Jython dev team?

On 9/2/07, Kenneth McDonald <kenneth.m.mcdonald <at> sbcglobal.net> wrote:
> I just noticed on Sourceforge that there are 18 people (mostly
> developers) registered as being active on Jython, and am wondering if
> that's accurate in terms of current, active developers.
rs <at> lists.sourceforge.net

That list includes many inactive developers -- I'd say about 50% of
the list are active.  http://www.jython.org/Project/contributors.html
is a little better, but is missing 4 or 5 newer comitters and needs
updating.

In short, I'd say there are 9 or 10 active committers at the moment.

-Frank

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
astigmatik | 3 Sep 05:26
Picon

Re: Where best to find documentation?

On 9/1/07, Kenneth McDonald <kenneth.m.mcdonald <at> sbcglobal.net> wrote:
> At the moment, I'd guess that Jython users are a (small) sub-group of
> Python hackers,
> i.e. not users but rather the subgroup who both use and really enjoy
> playing with Python.
> This is an unfortunate consequence of the fact that Jython went dormant
> for such a long time;
> there's going to be a certain hesitancy about Jython until people
> believe it's here to stay.
> I myself confess to using JRuby at the moment, though I'd (probably)
> prefer Jython, which
> is why I'm looking at it :-).
>

I'm 100% Jythonista. No dabbling with Python whatsoever. As for JRuby,
it sucks. Just compare the two:

JRuby:
require 'java'
include_class "javax.swing.JFrame"
include_class "javax.swing.JLabel"
frame = JFrame.new()
frame.getContentPane().add(JLabel.new("This is an example."))
frame.pack()
frame.setVisible(true)

Jython:
from javax.swing import JFrame, JLabel
frame = JFrame('no more new keyword',
defaultCloseOperation=JFrame.EXIT_ON_CLOSE)
frame.contentPane.add(JLabel('Too_many_underscores_are_ugly'))
frame.pack()
frame.show()

With Jython, it's easy to convert Java code to Jython code. Plus, you
can do this in Jython:

iframe = JInternalFrame('Title', internalFrameClosing=myfunc,
internalFrameActivated=etc.)

That means you can make a subclass of a JFrame/JInternalFrame, et. al.
without having to implement an interface. Example:

class MDIChildFrame(JInternalFrame):
   def __init__(self, strTitle):
      JInternalFrame.__init__(self, strTitle, 1, 1, 1, 1,
internalFrameActivated=self.onActive,
internalFrameIconified=self.onIconify)
      self.contentPane.add(JButton('press me', actionPerformed=self.onButton))
   def onActive(self, event):
      print 'This iframe was activated!'
   def onIconify(self, event):
      print 'This iframe was iconified!'
   def onButton(self, event):
      print 'Dont try this at home kids'

Basically, I've covered the event-handling for both the JInternalFrame
AND its JButton in one class. It's simple, straightforward, clean,
manageable, not confusing, etc.

And I seriously hate the def/end in Ruby. Reminds me of VB.

> 2) It needs to be really, really solid, both with respect to correctness
> and (to a useful level)
> completeness in its interoperability with Java. I don't know what
> Jython's status is at this point.
> Both Groovy

Groovy is a joke. Sorry if there are any groovy developers out there :-/

>
> 3) Here is the big one that will be the biggest stumbling block for most
> of these efforts; it needs
> good documentation so that a person can start doing useful things
> immediately, and also be able to go
> back to find the highly technical information they'll need as they start
> tacking more complex
> problems.
>

I guess that's true. The docs will come when Jython gains more popularity.

> I don't know about others, but my main interest in getting Python
> or Ruby working with Java is to (finally) have a (half-)decent, true,
> crossplatform GUI platform
> that I can write a decent high-level API around. To get more people
> interested in Jython
> (assuming it's solid and complete enough right now to focus on this),
> perhaps illustrate Jython
> by example by starting to develop a UI library on top of Swing, and
> documenting aspects of that?
> This approach has these advantages:
>
>     1) It can solve a real problem; writing Swing apps in Java is
> absurdly nasty, that's why all
>     these GUI dev tools are needed.
>
>     2) It's visually appealing, so you'll get eyeballs.
>
>     3) It provides lots of scope for illustrating how to do things like
> subclass Java classes in Jython
>     (if that's possible), define Java classes in Jython (if that's
> possible), etc.
>

It's true that writing a Swing app sucks. This is not the case in
Jython, however. And I don't think a UI lib should be written on top
of Jython. No need to reinvent the wheel, IMHO.

I'm developing a desktop application in Jython right now and I think
this has been the easiest language to use when writing GUI apps.
Here's a sample line from my project:

s = (105, 25)
self.button = JToggleButton(self._getTitle(), self._getIcon(), focusable=0,
                           preferredSize=s, minimumSize=s, maximumSize=s,
                           font=self._getFont(),
horizontalAlignment=SwingConstants.LEFT, margin=(1, 2, 1, 2),
actionPerformed=self.onButton)

And, you can still do self.button.setHorizontalAlignment(something) later on.

Even if we compare Jython and WxPython, the former is more Pythonic
than the latter.

Here's a screenshot of the first generation of my app, written purely in Jython:

http://astigmatik.googlepages.com/jeprox.jpg

Sorry for the quality of the screenshot. I'm rewriting it right now,
and the newer version looks better and has more features.

And that concludes my $0.02 on this discussion :-)

Best regards,
astigmatik

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/

Gmane