You can try and edit the jython.bat and change the java command to run with javaw

-Brandon

On May 26, 2010 7:19 AM, <jmpmega-11@yahoo.com> wrote:

[J]


> (1) When using Swing, I would prefer that no console window was launched (like with Python's pyth...

[Alex]


> How are you deploying your app? I've NEVER seen a console (white on black, cli window)
> being la...


I am deploying it as a Jython script (.jpy) on Windows XP.  The first time I double clicked on it, Windows asked me what program to run it with, I selected the jython.bat.  I put the script below in "Foo.jpy" and double clicked on it.  I get the JFrame as expected, but also a console window where jython would put prints (and I assume System.(out|err).prints) and where interpreter errors get logged.

Am I doing something profoundly dumb regarding deployment?

I have other Jython scripts which I invoke from the shell on UNIX, and behave as I would expect for both Python and Java programs.  But for front-end programs on Windows, it seems to expect a console to log to.  Python scripts using Tk have this same issue, which is why Python bundles a "pythonw" launcher to use instead.




#! /usr/bin/env jython

import sys

from javax.swing import JFrame, JLabel, JButton, UIManager, BoxLayout

def main(argv):

    UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName())

    f = JFrame()
    f.defaultCloseOperation = JFrame.EXIT_ON_CLOSE
    f.contentPane.layout = BoxLayout(f.contentPane, BoxLayout.X_AXIS)

    f.add(JLabel("Hello World"))
    f.add(JButton("Button", actionPerformed=cb_Button))

    f.pack()
    f.visible = True

def cb_Button(event):
    pass

if __name__ == '__main__':
    main(sys.argv)




------------------------------------------------------------------------------


_______________________________________________
Jython-users mailing list
Jython-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jython-users