Jython tutorial

Discussion in 'Programmer's Corner' started by syed_husain, Sep 25, 2011.

  1. syed_husain

    Thread Starter Active Member

    Aug 24, 2009
    61
    5
    can anyone give me some resources about how to learn JYTHON apart from its website? as i don't know java i am having quite problem with different java module like, swing, io. btw, i found wxpython quite hard to understand.
     
  2. bertus

    Administrator

    Apr 5, 2008
    15,647
    2,346
  3. syed_husain

    Thread Starter Active Member

    Aug 24, 2009
    61
    5
    thanks for the link. but still it did not serve my purpose. i think i was not clear enough in my first post. look at this simple example.

    Code ( (Unknown Language)):
    1. from javax.swing import *
    2. from java.awt import *
    3.  
    4.  
    5. #show two message by clicking two buttons
    6. frame = JFrame("Title",size=(300,120))
    7. button1 = JButton("Click")
    8. frame.add(button1)
    9. button1.setSize(10,10)
    10. button1.setLocation(10,10)
    11.  
    12. button2 = JButton("Click2")
    13. frame.add(button2)
    14. button2.setSize(10,10)
    15. button2.setLocation(20,20)
    16.  
    17. frame.visible = True
    what i want is to create 2 buttons and when clicked they will show two different messages. but i could not even able to create two buttons nor i can resize or set the locations of these buttons. what i need is a tutorial that will help me how to use JButton, JFrame etc. by using Jython. i have fair knowledge of python and most of the jython tutorials i found they are actually talking about python syntax. i went oracle site to find out more about JButton and JFrame and from there i found out about the setSize and setLocation method but it did not work when i used it in my jython code.

    any help will be much appreciated. thanks in advance.
     
  4. bertus

    Administrator

    Apr 5, 2008
    15,647
    2,346
    syed_husain likes this.
  5. syed_husain

    Thread Starter Active Member

    Aug 24, 2009
    61
    5
Loading...