AuthDialog 질문입니다.
138
작성한 질문수 18
AuthDialog.py 를 만들고 Main에서 다음과 같이 불러올 때
@pyqtSlot()
def authCheck(self) :
dlg = AuthDialog()
dlg.exec_()
dlg.show() 없이 창이 띄어집니다.
이 이유가
if __name__ == "__main__" : 에서
you_viewer_main = Main() #Class Main
you_viewer_main.show()
전체를 한번 show() 해줘서 가능한 건가요?
답변 1
1
안녕하세요.
exec_() 자체가 이벤트 루프를 생성하므로, 창이 보여지게 됩니다.
app.exec_() does not lock anything, it runs a GUI event loop that waits for user actions (events) and dispatches them to the right widget for handling. It does this until there are no top level windows left open; if you leave at least one top level window of your app open, then exec() never returns, it can't (your app will be terminated during system shutdown). When no more top level windows the app cleans up and returns from exec(). At that point the GUI is no longer in the event loop.
Whatever it is you want to do after exec() it is likely you would either put it in a QThread or in a signal handler (which you would connect, for example, to a "Go!" button; you would connect a "Cancel" button to a handler that closes the app window).
You can put code after exec() but it would be rather unconventional: if anything goes wrong it is unlikely that user can see the problem since the GUI is no longer visible, a GUI app doesn't usually have a console terminal open where the error might be seen, there will not typically be a console for a GUI app (ie you will run the app via pythonw.exe instead of python.exe), or you have to open a new window and exec() again in order to show an error message and wait till user clicks ok, destroy message window in ok handler so app.exec() once again returns.
현재 예제에서 error 발생
0
367
3
유튜브 동영상 다운로드
0
1446
2
Atom 에디터 관련
0
337
1
위시켓 폼데이터
0
274
1
스케줄러 사용 관련 질문 드립니다
0
627
1
selenium 에러
0
428
1
Progress bar 쓰레드 관련
0
489
1
Install Package 관련 문의
0
328
1
tkinter 샘플 코드 실행 오류 건
0
1266
1
4-7-6 네이버 & 카카오 주식 정보 가져오기
0
380
1
네이버자동로그인_by_selenium
0
875
1
위시캣 로그인 처리 및 크롤링 질문
0
344
1
2-8-1 네이버이미지 크롤링 질문
1
604
3
li:nth-of-type 질문
0
350
2
에러가 뜨는데 잘 모르겠어요ㅠ
0
401
2
Install Packages 항목이 안보이는 이유가 뭘까요?
0
400
2
환경변수 Path 설정 방법
0
631
1
웹 브라우저 없는 스크랩핑 및 파싱 실습(1) - 인프런
0
333
1
웹 브라우저 없는 스크랩핑 및 파싱 실습(1) -git주소
0
475
3
download2-8-1. py질문
0
203
1
ip 차단 당하는 거 같은데 아무리 랜덤주고, sleep 줘도 안 되는데 다른 방법 더 있을까요??
0
645
1
인프런 환경이 바뀌어서 제나름대로 하는데
0
196
1
다시올려주신 예제파일로하는데
0
190
1
아직도 에러가뜨나보네요?
0
584
1





