Browse Source

add icon generator function

master
Nils 4 years ago
parent
commit
9a2552c5c2
  1. 10
      template/qtgui/helper.py

10
template/qtgui/helper.py

@ -21,9 +21,17 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
import logging; logger = logging.getLogger(__name__); logger.info("import")
from PyQt5 import QtGui, QtWidgets
from PyQt5 import QtCore, QtGui, QtWidgets
from hashlib import md5
def iconFromString(st, size=128):
px = QtGui.QPixmap(size,size)
color = stringToColor(st)
px.fill(color)
return QtGui.QIcon(px)
def stringToColor(st):
"""Convert a string to QColor. Same string, same color
Is used for group coloring"""

Loading…
Cancel
Save