프로그래밍과 잡담

PySide 본문

프로그래밍/Qt

PySide

크레온 2010. 11. 15. 03:58
이것이 무엇인가 하면..

Qt에 Python바인딩이다.

즉.. Python에서 Qt를 사용할 수 있다는것이다.

물론 PyQt라는게 있긴 한데.. 그건 라이센스가 GPL 밖에 없거든..

그래서 노키아에서 LGPL 형태로 PySide라는걸 만들었다.

PyQt하고 사용법이 같다는데 나는 모르겠어 안사용해봐서..

방금 잠깐 해봤네..
이 라이브러리를 다운 받을려면 http://www.pyside.org/ 여기로 들어가면 있다.

 
from PySide.QtCore import *
from PySide.QtGui import *
import sys


class MyWidget(QWidget):
    def __init__(self,parent = None):
        QWidget.__init__(self,parent)
        self.resize(320,240)
        self.setWindowTitle("Test");
        self.setComponent()
        
    
    def setComponent(self):
        self.label = QLabel("Label",self)
        self.label.setGeometry(10,10,50,20);
        
        
        
        self. btn = QPushButton(self);
        self.btn.setText("button")
        self.btn.setGeometry(QRect(30,50,50,30) )
        
        self.connect(self.btn, SIGNAL('clicked()'), SLOT('showMessage()' ))
    
    
    def showMessage(self):
        QMessageBox.about(None, "Button click","Clicked");


def main():
    
    ap =  QApplication(sys.argv)
   
    m = MyWidget()
    
    m.show()

    sys.exit( ap.exec_() )

main()
    

반응형

'프로그래밍 > Qt' 카테고리의 다른 글

[Qt] Qt 5.0.1  (0) 2013.03.17
[Qt] dll or lib 사용할때..  (0) 2010.09.30
QDomDocument 사용법..  (0) 2010.08.16
[Qt] OpenGL에서 팝업(Popup) 메뉴 사용하기..  (0) 2010.06.19
[Qt]스타일쉬트(Style Sheet) 사용하기.  (0) 2010.06.03
Comments