조회 수 11577 추천 수 0 댓글 0
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄

 import sys
from PyQt4.QtCore import *
from PyQt4.QtGui import *


class MyApp(QWidget):
    def __init__(self,*args,**kwargs):
        QWidget.__init__(self,*args,**kwargs)
        self.current_timer = None
        self.layout = QVBoxLayout(self)
        self.button = QPushButton('start timer')
        self.button.clicked.connect(self.start_timer)
        self.layout.addWidget(self.button)

    def start_timer(self):
        if self.current_timer:
            self.current_timer.stop()
            self.current_timer.deleteLater()
        self.current_timer = QTimer()
        self.current_timer.timeout.connect(self.print_hello)
        self.current_timer.setSingleShot(True)
        self.current_timer.start(3000)

    def print_hello(self):
        print 'hello'


# Create QApplication and QWidget
qapp = QApplication(sys.argv)  
app = MyApp()
app.show()
qapp.exec_()



TAG •

  1. pybind11 에 대해서

  2. Qt For Python(PySide2) QML 프로젝트 예제

  3. 명령어 한줄로 내컴퓨터를 웹서버로

  4. pydbus 바인딩을 이용하여 서비스 데몬과 D-Bus통신

  5. Boost Python을 이용하여 python을 위한 C++ API 바인딩

  6. No Image 25Jun
    by makersweb
    2015/06/25 by makersweb
    Views 10652 

    [Python]EXE또는 DLL파일의 버전정보를 알아내기위한 몇가지 방법

  7. QML 및 Window 투명처리

  8. [pyqt4]QTimer 예제 - 버튼을 누르면 3초후 함수 또는 메소드 호출

  9. Python + QML with PyQt4

  10. print를 로그파일로 생성하기 (log출력 Redirection)

  11. 외부 프로그램 실행

  12. 우분투에 Python새 버전 설치 사용법

  13. No Image 06Sep
    by pjk
    2014/09/06 by pjk
    Views 6499 

    How to Use Freeze

  14. [PyQt4]개발 프로그램 버전표시 메세지 박스

  15. [PyQt4]여러가지 버튼 예제

  16. Python 문자열 관련 함수 레퍼런스

  17. [PyQt4]스레드 및 ProgressBar 예제 코드

  18. [PyQt4]multiprocess 예제 코드

  19. [PyQt4]마우스 클릭 이벤트 예제 코드

  20. [PyQt4]폴더 또는 파일을 드레그하여 그 경로를 LineEdit로 가져오기

Board Pagination Prev 1 2 Next
/ 2