11 January 2018

Python Basic Gui

#To make a simple gui follow the instructions. You need to at first install PyQt4 in your system. If you use linux run the code sudo apt-get install python3-pyqt4. For another system you just need to setup an application file. Google it for this. After installing pyqt4 modulo just write down the foling code. it will show you a simple gui.

import sys
from PyQt4 import QtGui


def main():
   
    app = QtGui.QApplication(sys.argv)

    w = QtGui.QWidget()
    #w.resize(250, 150)
    #w.move(300, 300)
    w.setGeometry(10,10,400,400)
    w.setWindowTitle('Simple GUI in Python')
    w.show()
   
    sys.exit(app.exec_())


if __name__ == '__main__':
    main()

No comments:

Post a Comment

UVA 10679 - I Love Strings!!