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_()
번호 | 제목 | 글쓴이 | 날짜 | 조회 수 |
---|---|---|---|---|
10 |
QML 및 Window 투명처리
![]() | makersweb | 2015.04.22 | 6262 |
» | [pyqt4]QTimer 예제 - 버튼을 누르면 3초후 함수 또는 메소드 호출 | makersweb | 2015.04.01 | 12163 |
8 | Python + QML with PyQt4 | makersweb | 2015.03.24 | 10038 |
7 | [PyQt4]개발 프로그램 버전표시 메세지 박스 | pjk | 2014.09.02 | 9773 |
6 |
[PyQt4]여러가지 버튼 예제
![]() | pjk | 2014.08.29 | 19619 |
5 |
[PyQt4]스레드 및 ProgressBar 예제 코드
![]() | pjk | 2014.08.26 | 9882 |
4 | [PyQt4]multiprocess 예제 코드 | pjk | 2014.08.26 | 9731 |
3 | [PyQt4]마우스 클릭 이벤트 예제 코드 | pjk | 2014.08.26 | 8053 |
2 |
[PyQt4]폴더 또는 파일을 드레그하여 그 경로를 LineEdit로 가져오기
![]() | pjk | 2014.08.22 | 15240 |
1 |
[PyQt4]윈도우창에 별 찍기 예제
![]() | pjk | 2014.08.19 | 9833 |