我有下面的代码,我希望根据国家/地区选择填充第二个选择元素。因此,如果用户选择美国,它将填充第一个数组,例如阿拉斯加将是文本,AK 将是值,阿拉巴马州将是文本,AL 将是值等等......
<p>
<select id="country" name ="country">
<option value="select">Select country</option>
<option value="US">United States</option>
<option value="CA">Canada</option>
</select>
</p>
<p>
<select name ="state" id ="state">
<option value="select">Select state/province</option>
</select>
</p>
<script>
var us_states = {"AK":"Alaska", "AL":"Alabama", "AR":"Arkansas", "AS":"American Samoa", "AZ":"Arizona", "CA":"California", "CO":"Colorado", "CT":"Connecticut", "DC":"District of Columbia", "DE":"Delaware", "FL":"Florida", "FM":"Federated States of Micronesia", "GA":"Georgia", "GU":"Guam", "HI":"Hawaii", "IA":"Iowa", "ID":"Idaho", "IL":"Illinois", "IN":"Indiana", "KS":"Kansas", "KY":"Kentucky", "LA":"Louisiana", "MA":"Massachusetts", "MD":"Maryland", "ME":"Maine", "MH":"Marshall Islands", "MI":"Michigan", "MN":"Minnesota", "MO":"Missouri", "MP":"Northern Mariana Islands", "MS":"Mississippi", "MT":"Montana", "NC":"North Carolina", "ND":"North Dakota", "NE":"Nebraska", "NH":"New …Run Code Online (Sandbox Code Playgroud) 我有一个名为guiNext.py和next.py的PyQt5 Ui,正在刷新用户界面。如何向UI按钮添加功能?这就是我所拥有的,当我运行next.py并单击HELLO按钮时,什么也没有发生。
guiNext.py:
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'guiNext_001.ui'
#
# Created by: PyQt5 UI code generator 5.6
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_nextGui(object):
def setupUi(self, nextGui):
nextGui.setObjectName("nextGui")
nextGui.resize(201, 111)
nextGui.setMinimumSize(QtCore.QSize(201, 111))
nextGui.setMaximumSize(QtCore.QSize(201, 111))
self.centralwidget = QtWidgets.QWidget(nextGui)
self.centralwidget.setObjectName("centralwidget")
self.helloBtn = QtWidgets.QPushButton(self.centralwidget)
self.helloBtn.setGeometry(QtCore.QRect(10, 10, 181, 91))
self.helloBtn.setObjectName("helloBtn")
nextGui.setCentralWidget(self.centralwidget)
self.retranslateUi(nextGui)
QtCore.QMetaObject.connectSlotsByName(nextGui)
def retranslateUi(self, nextGui):
_translate = QtCore.QCoreApplication.translate
nextGui.setWindowTitle(_translate("nextGui", "MainWindow"))
self.helloBtn.setText(_translate("nextGui", …Run Code Online (Sandbox Code Playgroud)