Utils: support messagebox on windows without dependencies (#2224)
This commit is contained in:
		
							parent
							
								
									6f9484f375
								
							
						
					
					
						commit
						0d8a868ed9
					
				
							
								
								
									
										5
									
								
								Utils.py
								
								
								
								
							
							
						
						
									
										5
									
								
								Utils.py
								
								
								
								
							| 
						 | 
					@ -680,6 +680,11 @@ def messagebox(title: str, text: str, error: bool = False) -> None:
 | 
				
			||||||
        if zenity:
 | 
					        if zenity:
 | 
				
			||||||
            return run(zenity, f"--title={title}", f"--text={text}", "--error" if error else "--info")
 | 
					            return run(zenity, f"--title={title}", f"--text={text}", "--error" if error else "--info")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    elif is_windows:
 | 
				
			||||||
 | 
					        import ctypes
 | 
				
			||||||
 | 
					        style = 0x10 if error else 0x0
 | 
				
			||||||
 | 
					        return ctypes.windll.user32.MessageBoxW(0, text, title, style)
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
    # fall back to tk
 | 
					    # fall back to tk
 | 
				
			||||||
    try:
 | 
					    try:
 | 
				
			||||||
        import tkinter
 | 
					        import tkinter
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue