使用python编写出基金APP界面实例
时间: 2023-08-24 11:04:04 浏览: 42
好的,我可以给你提供一个使用PyQt5编写的基金APP界面示例代码,供你参考:
```python
import sys
from PyQt5.QtWidgets import QApplication, QMainWindow, QLabel, QLineEdit, QTextEdit, QComboBox, QPushButton
class FundApp(QMainWindow):
def __init__(self):
super().__init__()
self.initUI()
def initUI(self):
# 设置窗口标题和大小
self.setWindowTitle('基金APP')
self.setGeometry(100, 100, 500, 500)
# 添加基金代码输入框和查询按钮
self.fund_code_label = QLabel('基金代码:', self)
self.fund_code_label.move(20, 20)
self.fund_code_edit = QLineEdit(self)
self.fund_code_edit.move(100, 20)
self.fund_code_edit.resize(150, 30)
self.search_btn = QPushButton('查询', self)
self.search_btn.move(280, 20)
self.search_btn.resize(80, 30)
# 添加基金类型选择框和基金列表展示框
self.fund_type_label = QLabel('基金类型:', self)
self.fund_type_label.move(20, 80)
self.fund_type_combobox = QComboBox(self)
self.fund_type_combobox.addItem('股票型')
self.fund_type_combobox.addItem('债券型')
self.fund_type_combobox.addItem('混合型')
self.fund_type_combobox.addItem('货币型')
self.fund_type_combobox.move(100, 80)
self.fund_type_combobox.resize(150, 30)
self.fund_list_label = QLabel('基金列表:', self)
self.fund_list_label.move(20, 140)
self.fund_list_edit = QTextEdit(self)
self.fund_list_edit.move(20, 180)
self.fund_list_edit.resize(460, 250)
# 添加退出按钮
self.quit_btn = QPushButton('退出', self)
self.quit_btn.move(200, 450)
self.quit_btn.resize(80, 30)
self.quit_btn.clicked.connect(QApplication.instance().quit)
# 显示窗口
self.show()
if __name__ == '__main__':
app = QApplication(sys.argv)
fundApp = FundApp()
sys.exit(app.exec_())
```
运行代码后,你将会看到一个基金APP的窗口,可以输入基金代码、选择基金类型、查询基金列表,以及退出应用。当然,这只是一个简单的示例代码,你可以根据自己的需求和实际情况进行修改和扩展。