Facing a problem when converting my .py
file to .exe
using pyinstaller --noconsole
, the messagebox won't work in exe file except if I created it without using --noconsole
or --windowed
.
I have tried to not use --noconsole
and use .pyw
file instead but this won't make the the console hidden when running the .exe
file
Asked
Active
Viewed 69 times
-3

Ben the Coder
- 539
- 2
- 5
- 21

AmdDwg
- 11
- 3
-
Does this help?: https://stackoverflow.com/questions/17280637/tkinter-messagebox-without-window – The Amateur Coder Mar 06 '23 at 11:57
-
am already using a window but it seems the app is closing since the console is not running and that is why the button doesn't trigger the func. maybe if there is way to keep the application running as long as the tkinter window is open – AmdDwg Mar 06 '23 at 13:27
-
1Sorry, I'm not familiar with `tkinter`'s `messagebox`. Please [edit] your post to include relevant code (see [mcve]). If you're using a library other than `tkinter` or other than the ones which come bundled with Python, check if you include them using something like `--add-data` or `--hidden-import`. Also, please include the exact PyInstaller command you're using in the CMD/terminal to create the EXE file. – The Amateur Coder Mar 06 '23 at 13:35
-
"the msgbox wont work in exe file" This does not tell us much... Please post the error code you are receiving and create a [mre] – Alexander Mar 06 '23 at 23:46
1 Answers
1
when removing the print(f'Error printing barcode') it works fine with me
try:
mysocket.connect((host, port)) # connecting to host
except:
host = another_host
mysocket.connect((host, port))
mysocket.send(zpl_b)
mysocket.close() # closing connection
print(f'Error printing barcode')
mbox= res +" barcode printed. from study: "+ dict_data["study_id"]
messagebox.showinfo("Printed",mbox)

AmdDwg
- 11
- 3