File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -95,12 +95,16 @@ def _register_window(self):
95
95
self .wndclass .style = win32con .CS_HREDRAW | win32con .CS_VREDRAW
96
96
self .wndclass .lpfnWndProc = message_map
97
97
self .wndclass .hInstance = win32api .GetModuleHandle ()
98
- self .wndclass .hIcon = win32gui .LoadIcon (self .wndclass .hInstance , 1 )
99
98
self .wndclass .hCursor = win32gui .LoadCursor (win32con .NULL , win32con .IDC_ARROW )
100
99
self .wndclass .hbrBackground = win32gui .GetStockObject (win32con .WHITE_BRUSH )
101
100
self .wndclass .lpszMenuName = ""
102
101
self .wndclass .lpszClassName = "MainWin"
103
102
103
+ try : # Try loading an icon embedded in the exe file. This will when frozen with PyInstaller
104
+ self .wndclass .hIcon = win32gui .LoadIcon (self .wndclass .hInstance , 1 )
105
+ except :
106
+ pass
107
+
104
108
# Register Window Class
105
109
if not win32gui .RegisterClass (self .wndclass ):
106
110
raise WinError ()
@@ -177,7 +181,7 @@ def show(self):
177
181
win32gui .UpdateWindow (self .atlhwnd )
178
182
win32gui .SetFocus (self .atlhwnd )
179
183
180
- # Pump messages
184
+ # Start sending and receiving messages
181
185
win32gui .PumpMessages ()
182
186
183
187
def destroy (self ):
You can’t perform that action at this time.
0 commit comments