The Artima Developer Community
Sponsored Link

Python Buzz Forum
Daily Python-URL: Python port of SWT?

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Ed Taekema

Posts: 52
Nickname: etaekema
Registered: Jul, 2004

Ed Taekema is a wandering Jython enthusiast
Daily Python-URL: Python port of SWT? Posted: Jan 18, 2005 9:31 PM
Reply to this message Reply

This post originated from an RSS feed registered with Python Buzz by Ed Taekema.
Original Post: Daily Python-URL: Python port of SWT?
Feed Title: All things Jythonic
Feed URL: http://www.pycs.net/users/0000177/categories/jython/rss.xml
Feed Description: Blogging Jython...
Latest Python Buzz Posts
Latest Python Buzz Posts by Ed Taekema
Latest Posts From All things Jythonic

Advertisement

Scott Sanders (dotnot) asks: Is anyone working on a port of SWT to Python? Is anyone interested in such a thing?

Of course this is something that is possible today using Jython.  I have configured the RedRobin Jython Eclipse plugin to allow me to easily script SWT (and JFace from Jython ... works like a charm.)  Here is a quick Jython Hello World for SWT.

from org.eclipse.jface.window import *
from org.eclipse.swt import *
from org.eclipse.swt.widgets import *
import sys

class Hello(ApplicationWindow):
  def createContents(self, parent):
  b = Button(parent, SWT.PUSH, widgetSelected=self.helloWorld)
  b.text = "Hello World"
  return b    
  def helloWorld(self, evt):
     print "Hello There ..." 
     sys.exit(0)        
 
w = Hello(None)
w.blockOnOpen = 1
w.open()
Display.getCurrent().dispose()

In order to get this to work in eclipse using the Jython plugin, you need to either create a jython project in eclipse or add the Jython nature to an existing project, add the swt and jface jars into the class path in the project's jython properties and finally set the java.library.path to the location of the swt library also in the project's jython  properties.  This last step is so that swt can find its os native libraries. 

[via Planet Python]

Read: Daily Python-URL: Python port of SWT?

Topic: Tagsonomy Management Previous Topic   Next Topic Topic: Not understanding syndication

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use