本文整理汇总了Python中PyQt5.QtGui.QPushButton方法的典型用法代码示例。如果您正苦于以下问题:Python QtGui.QPushButton方法的具体用法?Python QtGui.QPushButton怎么用?Python QtGui.QPushButton使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt5.QtGui
的用法示例。
在下文中一共展示了QtGui.QPushButton方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: make_buttons
# 需要导入模块: from PyQt5 import QtGui [as 别名]
# 或者: from PyQt5.QtGui import QPushButton [as 别名]
def make_buttons(parent,b0):
# ----- CLASSIFIER BUTTONS -------
cllabel = QtGui.QLabel("")
cllabel.setFont(parent.boldfont)
cllabel.setText("<font color='white'>Classifier</font>")
parent.classLabel = QtGui.QLabel("<font color='white'>not loaded (using prob from iscell.npy)</font>")
parent.classLabel.setFont(QtGui.QFont("Arial", 8))
parent.l0.addWidget(cllabel, b0, 0, 1, 2)
b0+=1
parent.l0.addWidget(parent.classLabel, b0, 0, 1, 2)
parent.addtoclass = QtGui.QPushButton(" add current data to classifier")
parent.addtoclass.setFont(QtGui.QFont("Arial", 8, QtGui.QFont.Bold))
parent.addtoclass.clicked.connect(lambda: add_to(parent))
parent.addtoclass.setStyleSheet(parent.styleInactive)
b0+=1
parent.l0.addWidget(parent.addtoclass, b0, 0, 1, 2)
return b0
示例2: init_external_tab_ui
# 需要导入模块: from PyQt5 import QtGui [as 别名]
# 或者: from PyQt5.QtGui import QPushButton [as 别名]
def init_external_tab_ui(self):
"""External data."""
self.external_tab = QtGui.QWidget()
self.external_tab.setEnabled(False)
self.external_layout = QtGui.QVBoxLayout(self.external_tab)
self.import_data_name = QtGui.QLabel('Import External Data')
self.import_data_label = QtGui.QLabel('...')
self.import_data_btn = QtGui.QPushButton('Import')
self.import_data_btn.clicked.connect(self.open_file)
self.external_layout.addWidget(
self.import_data_name, 0, QtCore.Qt.AlignCenter
)
self.external_layout.addWidget(
self.import_data_label, 0, QtCore.Qt.AlignCenter
)
self.external_layout.addWidget(
self.import_data_btn, 0, QtCore.Qt.AlignCenter
)
self.select_source.addTab(self.external_tab, 'Custom data')
示例3: __init__
# 需要导入模块: from PyQt5 import QtGui [as 别名]
# 或者: from PyQt5.QtGui import QPushButton [as 别名]
def __init__(self, parent=None):
super().__init__(parent)
self.setTitle('Strategy')
self.setAlignment(QtCore.Qt.AlignCenter)
self.layout = QtGui.QHBoxLayout(self)
self.layout.setContentsMargins(0, 0, 0, 0)
self.list = QtGui.QComboBox()
self.add_btn = QtGui.QPushButton('+')
self.add_btn.clicked.connect(self.add_strategies)
self.start_btn = QtGui.QPushButton('Start Backtest')
self.start_btn.clicked.connect(self.load_strategy)
self.layout.addWidget(self.list, stretch=2)
self.layout.addWidget(self.add_btn, stretch=0)
self.layout.addWidget(self.start_btn, stretch=0)
self.load_strategies_from_settings()
示例4: setup_behaviour_ui
# 需要导入模块: from PyQt5 import QtGui [as 别名]
# 或者: from PyQt5.QtGui import QPushButton [as 别名]
def setup_behaviour_ui(self):
"""Connects methods to UI elements."""
conf_button = self.options_ui.configure_button # Used instead of findChild(QtGui.QPushButton, "configure_button")
conf_button.clicked.connect(self.conf_button_function)
self.populate_ports()
refresh_ports = self.options_ui.refresh_ports_button
refresh_ports.clicked.connect(self.populate_ports)
start_needle_edit = self.options_ui.start_needle_edit
start_needle_edit.valueChanged.connect(self.__emit_needles)
stop_needle_edit = self.options_ui.stop_needle_edit
stop_needle_edit.valueChanged.connect(self.__emit_needles)
start_needle_color = self.options_ui.start_needle_color
start_needle_color.currentIndexChanged.connect(self.__emit_needles)
stop_needle_color = self.options_ui.stop_needle_color
stop_needle_color.currentIndexChanged.connect(self.__emit_needles)
alignment_combo_box = self.options_ui.alignment_combo_box
alignment_combo_box.currentIndexChanged.connect(self.__emit_alignment)
start_row_edit = self.options_ui.start_row_edit
start_row_edit.valueChanged.connect(self.__onStartLineChanged)
示例5: get_QPushButton
# 需要导入模块: from PyQt5 import QtGui [as 别名]
# 或者: from PyQt5.QtGui import QPushButton [as 别名]
def get_QPushButton():
"""QPushButton getter."""
try:
import PySide.QtGui as QtGui
return QtGui.QPushButton
except ImportError:
import PyQt5.QtWidgets as QtWidgets
return QtWidgets.QPushButton
示例6: initUI
# 需要导入模块: from PyQt5 import QtGui [as 别名]
# 或者: from PyQt5.QtGui import QPushButton [as 别名]
def initUI(self):
self.statsBox = QtWidgets.QTextBrowser(self)
#self.updateBtn = QtGui.QPushButton("Update", self)
#self.updateBtn.clicked.connect(self.calcStats)
layout = QtWidgets.QVBoxLayout()
layout.addWidget(self.statsBox)
#layout.addWidget(self.updateBtn)
self.setLayout(layout)
示例7: __init__
# 需要导入模块: from PyQt5 import QtGui [as 别名]
# 或者: from PyQt5.QtGui import QPushButton [as 别名]
def __init__(self,parent=None):
super(TextChooser, self).__init__(parent)
self.setGeometry(300,300,180,100)
self.setWindowTitle('h5 key')
self.win = QtGui.QWidget(self)
layout = QtGui.QGridLayout()
self.win.setLayout(layout)
self.qedit = QtGui.QLineEdit('data')
layout.addWidget(QtGui.QLabel('h5 key for data field'),0,0,1,3)
layout.addWidget(self.qedit,1,0,1,2)
done = QtGui.QPushButton('OK')
done.clicked.connect(self.exit_list)
layout.addWidget(done,2,1,1,1)
示例8: __init__
# 需要导入模块: from PyQt5 import QtGui [as 别名]
# 或者: from PyQt5.QtGui import QPushButton [as 别名]
def __init__(self, Text, parent=None):
super(ListChooser, self).__init__(parent)
self.setGeometry(300,300,500,320)
self.setWindowTitle(Text)
self.win = QtGui.QWidget(self)
layout = QtGui.QGridLayout()
self.win.setLayout(layout)
#self.setCentralWidget(self.win)
loadcell = QtGui.QPushButton('Load iscell.npy')
loadcell.resize(200,50)
loadcell.clicked.connect(self.load_cell)
layout.addWidget(loadcell,0,0,1,1)
loadtext = QtGui.QPushButton('Load txt file list')
loadtext.clicked.connect(self.load_text)
layout.addWidget(loadtext,0,1,1,1)
layout.addWidget(QtGui.QLabel('(select multiple using ctrl)'),1,0,1,1)
self.list = QtGui.QListWidget(parent)
layout.addWidget(self.list,2,0,5,4)
#self.list.resize(450,250)
self.list.setSelectionMode(QtGui.QAbstractItemView.MultiSelection)
save = QtGui.QPushButton('build classifier')
save.clicked.connect(lambda: self.build_classifier(parent))
layout.addWidget(save,8,0,1,1)
self.apply = QtGui.QPushButton('load in GUI')
self.apply.clicked.connect(lambda: self.apply_class(parent))
self.apply.setEnabled(False)
layout.addWidget(self.apply,8,1,1,1)
self.saveasdefault = QtGui.QPushButton('save as default')
self.saveasdefault.clicked.connect(lambda: self.save_default(parent))
self.saveasdefault.setEnabled(False)
layout.addWidget(self.saveasdefault,8,2,1,1)
done = QtGui.QPushButton('close')
done.clicked.connect(self.exit_list)
layout.addWidget(done,8,3,1,1)
示例9: init_shares_tab_ui
# 需要导入模块: from PyQt5 import QtGui [as 别名]
# 或者: from PyQt5.QtGui import QPushButton [as 别名]
def init_shares_tab_ui(self):
"""Shares."""
self.shares_tab = QtGui.QWidget()
self.shares_layout = QtGui.QFormLayout(self.shares_tab)
today = datetime.today()
self.shares_date_from = QtGui.QDateEdit()
self.shares_date_from.setMinimumDate(QtCore.QDate(1900, 1, 1))
self.shares_date_from.setMaximumDate(QtCore.QDate(2030, 12, 31))
self.shares_date_from.setDate(QtCore.QDate(today.year, 1, 1))
self.shares_date_from.setDisplayFormat('dd.MM.yyyy')
self.shares_date_to = QtGui.QDateEdit()
self.shares_date_to.setMinimumDate(QtCore.QDate(1900, 1, 1))
self.shares_date_to.setMaximumDate(QtCore.QDate(2030, 12, 31))
self.shares_date_to.setDate(
QtCore.QDate(today.year, today.month, today.day)
)
self.shares_date_to.setDisplayFormat('dd.MM.yyyy')
self.shares_symbol_list = QtGui.QComboBox()
self.shares_symbol_list.setFocusPolicy(QtCore.Qt.StrongFocus)
self.shares_symbol_list.setMaxVisibleItems(20)
self.shares_symbol_list.setEditable(True)
self.shares_show_btn = QtGui.QPushButton('Load')
self.shares_show_btn.clicked.connect(self.update_data)
self.shares_layout.addRow('From', self.shares_date_from)
self.shares_layout.addRow('To', self.shares_date_to)
self.shares_layout.addRow('Symbol', self.shares_symbol_list)
self.shares_layout.addRow(None, self.shares_show_btn)
self.select_source.addTab(self.shares_tab, 'Shares/Futures/ETFs')
示例10: init_timeframes_ui
# 需要导入模块: from PyQt5 import QtGui [as 别名]
# 或者: from PyQt5.QtGui import QPushButton [as 别名]
def init_timeframes_ui(self):
self.tf_layout = QtGui.QHBoxLayout()
self.tf_layout.setSpacing(0)
self.tf_layout.setContentsMargins(0, 12, 0, 0)
time_frames = ('1M', '5M', '15M', '30M', '1H', '1D', '1W', 'MN')
btn_prefix = 'TF'
for tf in time_frames:
btn_name = ''.join([btn_prefix, tf])
btn = QtGui.QPushButton(tf)
# TODO:
btn.setEnabled(False)
setattr(self, btn_name, btn)
self.tf_layout.addWidget(btn)
self.toolbar_layout.addLayout(self.tf_layout)
示例11: setup_ui
# 需要导入模块: from PyQt5 import QtGui [as 别名]
# 或者: from PyQt5.QtGui import QPushButton [as 别名]
def setup_ui(self, parent_ui):
self.parent_ui = parent_ui
dock = parent_ui.ui.knitting_options_dock
self.qwidget = QtGui.QWidget(dock)
self.configure_button = QtGui.QPushButton(self.qwidget)
self.configure_button.setObjectName(_fromUtf8("configure_button"))
self.configure_button.setText(_translate("DockWidget", "Configure", None))
self.configure_button.clicked.connect(self.__conf_button_function)
dock.setWidget(self.qwidget)
示例12: createButtons
# 需要导入模块: from PyQt5 import QtGui [as 别名]
# 或者: from PyQt5.QtGui import QPushButton [as 别名]
def createButtons(self):
iconSize = QtCore.QSize(30, 30)
openButton = QtGui.QPushButton('load ops.npy')
#openButton.setIcon(self.style().standardIcon(QtGui.QStyle.SP_DialogOpenButton))
#openButton.setIconSize(iconSize)
openButton.setToolTip("Open single-plane ops.npy")
openButton.clicked.connect(self.open)
openButton2 = QtGui.QPushButton('load ops1.npy')
#openButton2.setIcon(self.style().standardIcon(QtGui.QStyle.SP_DirOpenIcon))
#openButton2.setIconSize(iconSize)
#openButton2.setToolTip("Open multi-plane ops1.npy")
openButton2.clicked.connect(self.open_combined)
loadZ = QtGui.QPushButton('load z-stack tiff')
loadZ.clicked.connect(self.load_zstack)
self.computeZ = QtGui.QPushButton('compute z position')
self.computeZ.setEnabled(False)
self.computeZ.clicked.connect(self.compute_z)
self.playButton = QtGui.QToolButton()
self.playButton.setIcon(self.style().standardIcon(QtGui.QStyle.SP_MediaPlay))
self.playButton.setIconSize(iconSize)
self.playButton.setToolTip("Play")
self.playButton.setCheckable(True)
self.playButton.clicked.connect(self.start)
self.pauseButton = QtGui.QToolButton()
self.pauseButton.setCheckable(True)
self.pauseButton.setIcon(self.style().standardIcon(QtGui.QStyle.SP_MediaPause))
self.pauseButton.setIconSize(iconSize)
self.pauseButton.setToolTip("Pause")
self.pauseButton.clicked.connect(self.pause)
btns = QtGui.QButtonGroup(self)
btns.addButton(self.playButton,0)
btns.addButton(self.pauseButton,1)
btns.setExclusive(True)
quitButton = QtGui.QToolButton()
quitButton.setIcon(self.style().standardIcon(QtGui.QStyle.SP_DialogCloseButton))
quitButton.setIconSize(iconSize)
quitButton.setToolTip("Quit")
quitButton.clicked.connect(self.close)
self.l0.addWidget(openButton,1,0,1,2)
self.l0.addWidget(openButton2,2,0,1,2)
self.l0.addWidget(loadZ,3,0,1,2)
self.l0.addWidget(self.computeZ,4,0,1,2)
self.l0.addWidget(self.playButton,15,0,1,1)
self.l0.addWidget(self.pauseButton,15,1,1,1)
#self.l0.addWidget(quitButton,0,1,1,1)
self.playButton.setEnabled(False)
self.pauseButton.setEnabled(False)
self.pauseButton.setChecked(True)
示例13: __init__
# 需要导入模块: from PyQt5 import QtGui [as 别名]
# 或者: from PyQt5.QtGui import QPushButton [as 别名]
def __init__(self, parent=None):
super(MergeWindow, self).__init__(parent)
self.setGeometry(700,300,700,700)
self.setWindowTitle('Choose merge options')
self.cwidget = QtGui.QWidget(self)
self.layout = QtGui.QGridLayout()
self.layout.setVerticalSpacing(2)
self.layout.setHorizontalSpacing(25)
self.cwidget.setLayout(self.layout)
self.win = pg.GraphicsLayoutWidget()
self.layout.addWidget(self.win, 11, 0, 4, 4)
self.p0 = self.win.addPlot(row=0, col=0)
self.p0.setMouseEnabled(x=False,y=False)
self.p0.enableAutoRange(x=True,y=True)
# initial ops values
mkeys = ['corr_thres', 'dist_thres']
mlabels = ['correlation threshold', 'euclidean distance threshold']
self.ops = {'corr_thres': 0.8, 'dist_thres': 100.0}
self.layout.addWidget(QtGui.QLabel('Press enter in a text box to update params'), 0, 0, 1,2)
self.layout.addWidget(QtGui.QLabel('(Correlations use "activity mode" and "bin" from main GUI)'), 1, 0, 1,2)
self.layout.addWidget(QtGui.QLabel('>>>>>>>>>>>> Parameters <<<<<<<<<<<'), 2, 0, 1,2)
self.doMerge = QtGui.QPushButton('merge selected ROIs', default=False, autoDefault=False)
self.doMerge.clicked.connect(lambda: self.do_merge(parent))
self.doMerge.setEnabled(False)
self.layout.addWidget(self.doMerge, 9,0,1,1)
self.suggestMerge = QtGui.QPushButton('next merge suggestion', default=False, autoDefault=False)
self.suggestMerge.clicked.connect(lambda: self.suggest_merge(parent))
self.suggestMerge.setEnabled(False)
self.layout.addWidget(self.suggestMerge, 10,0,1,1)
self.nMerge = QtGui.QLabel('= X possible merges found with these parameters')
self.layout.addWidget(self.nMerge, 7,0,1,2)
self.iMerge = QtGui.QLabel('suggested ROIs to merge: ')
self.layout.addWidget(self.iMerge, 8,0,1,2)
self.editlist = []
self.keylist = []
k=1
for lkey,llabel in zip(mkeys, mlabels):
qlabel = QtGui.QLabel(llabel)
qlabel.setFont(QtGui.QFont("Times",weight=QtGui.QFont.Bold))
self.layout.addWidget(qlabel, k*2+1,0,1,2)
qedit = LineEdit(lkey,self)
qedit.set_text(self.ops)
qedit.setFixedWidth(90)
qedit.returnPressed.connect(lambda: self.compute_merge_list(parent))
self.layout.addWidget(qedit, k*2+2,0,1,2)
self.editlist.append(qedit)
self.keylist.append(lkey)
k+=1
print('creating merge window... this may take some time')
self.CC = np.matmul(parent.Fbin[parent.iscell], parent.Fbin[parent.iscell].T) / parent.Fbin.shape[-1]
self.CC /= np.matmul(parent.Fstd[parent.iscell][:,np.newaxis],
parent.Fstd[parent.iscell][np.newaxis,:]) + 1e-3
self.CC -= np.diag(np.diag(self.CC))
self.compute_merge_list(parent)