merkator

Untitled

Feb 5th, 2012
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.43 KB | None | 0 0
  1. #!/usr/bin/python
  2. # -*- coding: utf-8 -*-
  3.  
  4. import sys
  5. from PySide.QtCore import *
  6. from PySide.QtGui import *
  7.  
  8. string = ""
  9.  
  10. class Problems(QWidget):
  11.     par = None
  12.     def __init__(self, parent = None):
  13.         super(Problems, self).__init__(parent)
  14.         self.judgeid = QLineEdit("Enter your string")
  15.         self.button = QPushButton("Ok")        
  16.         layout = QVBoxLayout()
  17.         layout.addWidget(self.judgeid)
  18.         layout.addWidget(self.button)
  19.         self.setLayout(layout)
  20.         self.button.clicked.connect(self.login)
  21.         self.button.clicked.emit(parent)
  22.         print type(parent)
  23.    
  24.     @Slot(QWidget)  
  25.     def login(self, parent):
  26.         global string
  27.         string = self.judgeid.text()
  28.         a = QWidget()
  29.         parent.mainTile.addTab(a, "TestTab")
  30.  
  31. class Application(QWidget):
  32.     def __init__(self, parent = None):
  33.         super(Application, self).__init__(parent)
  34.         self.mainTile = QTabWidget()
  35.         self.setWindowTitle("Hello crazy world!")
  36.         layout = QVBoxLayout()
  37.         lay1 = Problems(self)
  38.         self.mainTile.addTab(lay1, "Problems")
  39.         layout.addWidget(self.mainTile)
  40.         self.setLayout(layout)
  41.  
  42.  
  43. if __name__ == '__main__':
  44.     # Create the Qt Application
  45.     app = QApplication(sys.argv)
  46.     # Create and show the form
  47.     mainWindow = Application()
  48.     mainWindow.show()
  49.     # Run the main Qt loop
  50.     sys.exit(app.exec_())
Advertisement
Add Comment
Please, Sign In to add comment