Skip to content

Instantly share code, notes, and snippets.

@matmr
Created March 15, 2015 17:52
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save matmr/72487a03da95b99db6ae to your computer and use it in GitHub Desktop.
Save matmr/72487a03da95b99db6ae to your computer and use it in GitHub Desktop.
pyqthraph dock label styling patch
from pyqtgraph.dockarea.Dock import DockLabel
def updateStylePatched(self):
r = '3px'
if self.dim:
fg = '#b0b0b0'
bg = '#94f5bb'
border = '#94f5bb'
# border = '#7cf3ac'
else:
fg = '#fff'
bg = '#10b151'
border = '#10b151'
if self.orientation == 'vertical':
self.vStyle = """DockLabel {
background-color : %s;
color : %s;
border-top-right-radius: 0px;
border-top-left-radius: %s;
border-bottom-right-radius: 0px;
border-bottom-left-radius: %s;
border-width: 0px;
border-right: 2px solid %s;
padding-top: 3px;
padding-bottom: 3px;
font-size: 18px;
}""" % (bg, fg, r, r, border)
self.setStyleSheet(self.vStyle)
else:
self.hStyle = """DockLabel {
background-color : %s;
color : %s;
border-top-right-radius: %s;
border-top-left-radius: %s;
border-bottom-right-radius: 0px;
border-bottom-left-radius: 0px;
border-width: 0px;
border-bottom: 2px solid %s;
padding-left: 13px;
padding-right: 13px;
font-size: 18px
}""" % (bg, fg, r, r, border)
self.setStyleSheet(self.hStyle)
DockLabel.updateStyle = updateStylePatched
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment