我正在使用QtableView显示我的日志并按列过滤它们,因此使用了QSortFilterProxyModel。如果我使用某个值对某一列进行过滤,并且对过滤后的数据进行过滤,则如果我尝试对第二列进行过滤,则会重置上一个过滤器,并显示与第二列上的过滤器相对应的数据。我想在Qtableview上实现多列过滤器。
程式码片段:
self.tableView = QTableView()
self.model = QtGui.QStandardItemModel(self)
self.proxy = QtGui.QSortFilterProxyModel(self)
self.proxy.setSourceModel(self.model)
self.tableView.setModel(self.proxy)
def updateTable(self):
self.model.invisibleRootItem().appendRow(,,,,)
def filterTable(self, stringAction, filterColumn):
filterString = QtCore.QRegExp( stringAction,
QtCore.Qt.CaseSensitive,
QtCore.QRegExp.FixedString
)
self.proxy.setFilterRegExp(filterString)
self.proxy.setFilterKeyColumn(filterColumn)
Run Code Online (Sandbox Code Playgroud) 我在使用动画的python GUI中使用matplotlib绘图.以下是代码
import sys
from PyQt4 import QtGui
from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as FigureCanvas
from matplotlib.backends.backend_qt4agg import NavigationToolbar2QT as NavigationToolbar
import matplotlib.pyplot as plt
import matplotlib.animation
import numpy as np
class Window(QtGui.QDialog):
def __init__(self, parent=None):
super(Window, self).__init__(parent)
self.figure = plt.figure()
self.canvas = FigureCanvas(self.figure)
self.toolbar = NavigationToolbar(self.canvas, self)
layout = QtGui.QVBoxLayout()
layout.addWidget(self.toolbar)
layout.addWidget(self.canvas)
self.setLayout(layout)
self.ax=self.figure.add_subplot(111)
plt.autoscale(enable=True, axis='both', tight=None #for auto scaling
self.data = [500, -500, 501, -502,.... 623] #some list of data
self.ax = plt.gca()
self.ax.grid()
self.sc = self.ax.scatter(self.data[::2], self.data[1::2]
def …Run Code Online (Sandbox Code Playgroud) 我下载了 Anaconda 用于 Windows 上的 python 用法。我正在使用 paramiko 模块进行 SSH。当我尝试使用 paramiko 进行 SSH 连接时,出现以下错误,
Traceback (most recent call last):
File "C:\Users\Anaconda2\lib\site-packages\paramiko\transport.py", line 545, in start_client
raise e
ImportError: DLL load failed: The operating system cannot run %1.
Run Code Online (Sandbox Code Playgroud)
我尝试将“C:\Users\*****\Anaconda2\Library\bin”路径设置为环境变量。但在里面没有用。仍然错误不断。
代码片段:
import paramiko
sftpSession = None
sshSession = paramiko.SSHClient()
sshSession.set_missing_host_key_policy(paramiko.AutoAddPolicy())
sshSession.connect(hostname=hostname,username=username,password=password,timeout=2)
Run Code Online (Sandbox Code Playgroud) pyqt4 ×2
python ×2
anaconda ×1
animation ×1
matplotlib ×1
paramiko ×1
plot ×1
pyqt ×1
python-2.7 ×1
qtableview ×1
scatter ×1