We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent b0ad594 commit 2620922Copy full SHA for 2620922
lib/matplotlib/backends/qt4_editor/formlayout.py
@@ -49,6 +49,8 @@
49
STDERR = sys.stderr
50
51
from matplotlib.backends.qt4_compat import QtGui,QtCore
52
+from matplotlib.colors import rgb2hex
53
+
54
if not hasattr(QtGui,'QFormLayout'):
55
raise ImportError, "Warning: formlayout requires PyQt4 >v4.3 or PySide"
56
@@ -103,6 +105,10 @@ def set_color(self, color):
103
105
104
106
color = QtCore.Property("QColor", get_color, set_color)
107
108
+def col2hex(color):
109
+ """Convert matplotlib color to hex before passing to Qt"""
110
+ return rgb2hex(colorConverter.to_rgb(color))
111
112
def to_qcolor(color):
113
"""Create a QColor from a matplotlib color"""
114
qcolor = QtGui.QColor()
0 commit comments