Skip to content

Instantly share code, notes, and snippets.

@whatalnk
Created February 15, 2017 14:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save whatalnk/762821786256875758da603517959298 to your computer and use it in GitHub Desktop.
Save whatalnk/762821786256875758da603517959298 to your computer and use it in GitHub Desktop.
from javax.swing import JButton, JFrame
from ij.io import Opener
from ij import IJ, ImagePlus
import sys
class MyFrame(JFrame):
def __init__(self):
JFrame.__init__(self, "Hello Jython")
button = JButton("Open", actionPerformed=self.openPushed)
self.add(button)
self.setSize(300, 300)
self.show()
def openPushed(self, event):
imagePath = IJ.getFilePath("Choose image")
# imp = Opener().openImage(imagePath)
# imp = ImagePlus(imagePath)
imp = IJ.openImage(imagePath)
imp.show()
if __name__=="__main__":
MyFrame()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment