python [Python:Tkinter桌面开发] #python #tkinter #tk #desktop

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了python [Python:Tkinter桌面开发] #python #tkinter #tk #desktop相关的知识,希望对你有一定的参考价值。

#### Running without console on Windows

https://stackoverflow.com/questions/1689015/run-python-script-without-windows-console-appearing

> **pythonw.exe** will run the script without a command prompt. The problem is that the Python interpreter, **Python.exe**, is linked against the console subsystem to produce console output (since that's 90% of cases) -- pythonw.exe is instead linked against the GUI subsystem, and Windows will not create a console output window for it unless it asks for one
from tkinter import *

def show():
	hello.set('Hello world!')

root = Tk()
root.title("Sample")
root.minsize(300, 200)
root.resizable(False, False)

listbox = Listbox(root)

for item in ["option1", "option2", "option3"]:
    listbox.insert(END, item)

hello = StringVar()
hello_label = Label(root, textvariable=hash).pack()
listbox.pack()

Button(root, text="Show", command=show).pack()

root.mainloop()

以上是关于python [Python:Tkinter桌面开发] #python #tkinter #tk #desktop的主要内容,如果未能解决你的问题,请参考以下文章

python [Python:Tkinter桌面开发] #python #tkinter #tk #desktop

Tkinter开发第一个桌面程序HelloWorld

python3 tkinter 桌面软件教程

python桌面开发,为啥选择PyQt或wxPython,而不使用Tkinter?

python图形界面:首选Tkinter

Python应用tkinter简介