How to hide cmd console when excute *.exe program compiling by Nuitka?

6.4k views Asked by At

I use this command to build my program,it generate an exe file that work well.but it always starts with cmd console program when tk program is running.How to avoid that happen?

python -m nuitka --mingw64 *.py

if I use --windows-disable-console command,it will generate a exe file that cannot not show tk program properly.

#encoding=utf-8
import tkinter

from tinter import *
import datetime
import sys,io

sys.stdout = io.TextIOWrapper(sys.stdout.buffer,encoding='utf-8')
class Example(object):
    """docstring for"""
    def __init__(self, date):
        self.date = date
    def main_gui(self):
        parent=Tk()
        parent.resizable(width=False, height=False)
        parent.title("incomeoutcome")
        parent.mainloop()


today=datetime.date.today()
ins_bill=Example(today)
ins_bill.main_gui()
1

There are 1 answers

0
user2849367 On BEST ANSWER

Delete the linesys.stdout = io.TextIOWrapper(sys.stdout.buffer,encoding='utf-8') ,and all program will be run correctly.This line of code only help show utf-8 character in emulator.