在Python中编写窗口程序,您可以使用以下流行的图形用户界面(GUI)库:
Tkinter
Python的标准GUI库,易于学习和使用。
示例代码:
```python
from tkinter import *
window = Tk()
window.title("My Window")
window.geometry("300x200")
label = Label(window, text="Hello, World!")
label.pack()
window.mainloop()
PyQt
功能强大的GUI库,基于Qt框架。
示例代码:
```python
from PyQt5.QtWidgets import QApplication, QMainWindow, QLabel
app = QApplication([])
window = QMainWindow()
window.setWindowTitle("My Window")
window.setGeometry(100, 100, 300, 200)
label = QLabel("Hello, World!", parent=window)
label.move(100, 100)
app.exec_()
wxPython
提供与wxWidgets跨平台GUI工具包的绑定。
选择哪个库取决于您的具体需求,例如对界面美观程度、功能丰富性、跨平台支持等方面的考虑。您可以根据自己的喜好和需求来选择适合的库进行开发。