Last active
August 29, 2015 14:03
-
-
Save remram44/2f81dc5e7bb1c7e57568 to your computer and use it in GitHub Desktop.
Translation of PyQt code at https://gist.github.com/remram44/9643396 to Julia
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using PyCall | |
| @pyimport sys | |
| @pyimport sip | |
| # Complicated stuff | |
| api2_classes = [ | |
| "QData", "QDateTime", "QString", "QTextStream", | |
| "QTime", "QUrl", "QVariant"] | |
| for cl = api2_classes | |
| try | |
| sip.setapi(cl, 2) | |
| catch | |
| end | |
| end | |
| @pyimport PyQt4.QtCore as QtCore | |
| @pyimport PyQt4.QtGui as QtGui | |
| app = QtGui.QApplication(sys.argv) | |
| window = QtGui.QWidget() | |
| window[:setLayout](QtGui.QVBoxLayout()) | |
| prompt = QtGui.QHBoxLayout() | |
| prompt[:addWidget](QtGui.QLabel("Name:")) | |
| name = QtGui.QLineEdit() | |
| prompt[:addWidget](name) | |
| window[:layout]()[:addLayout](prompt) | |
| button = QtGui.QPushButton("Go !") | |
| function say_it(a=false) | |
| QtGui.pymember("QMessageBox")[:information]( | |
| window, | |
| "Greetings", "Hi, $(name[:text]())") | |
| end | |
| button[:clicked][:connect](say_it) | |
| window[:layout]()[:addWidget](button) | |
| window[:show]() | |
| window[:adjustSize]() | |
| app[:exec_]() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment