pythontkinterpyinstallertkmessagebox

tkinter messagebox without console


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


Solution

  • 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)