Here is the code I have:
Here is what it is displaying:
I need to be able to change the color to make it readable, and I need to change the units to degrees Celsius instead of %. Can anyone help me with this?
Here is the code I have:
Here is what it is displaying:
I need to be able to change the color to make it readable, and I need to change the units to degrees Celsius instead of %. Can anyone help me with this?
It's been a while since I've done this in vision, but this script should be an example to help you out. I'm not sure about the degrees symbol though
if colName == 'completed':
from javax.swing import JProgressBar
from java.awt import Color
from java.awt import Font
def setTextColor(jbar, color):
jbar.putClientProperty("Synthetica.progressBar.textColor", color)
minValue = 0.0
maxValue = 100.0
colora = Color.RED
colorb = Color.GREEN
reda = colora.getRed()
greena = colora.getGreen()
bluea = colora.getBlue()
redb = colorb.getRed()
greenb = colorb.getGreen()
blueb = colorb.getBlue()
ratio = value * 100
foreColor = Color(71,169,230,255)
if value > 0.75:
backColor = Color(0,255,0,50)
elif value > 0.35:
backColor = Color(255,255,0,50)
else:
backColor = Color(255,0,0,50)
jbar = JProgressBar(int(minValue), int(maxValue))
fontColor = Color.BLACK
if value > 0.52:
fontColor = Color.WHITE
setTextColor(jbar,fontColor)
jbar.setValue(int(ratio))
jbar.setStringPainted(True)
jbar.setForeground(foreColor)
jbar.setBackground(backColor)
jbar.font = Font("Dialog", 1, 14)
return {"renderer": jbar}
elif colName == "Details":
from javax.swing import JButton
return { 'renderer' : JButton('View') }
elif selected:
return {'background':self.selectionBackground}
elif rowView % 2 == 0:
return {'background':'#CCFFCC'}
else:
return {'background':'white'}
This was super helpful! I still need to know how to format the text though. Does anyone know how to do that?
I figured out how to edit the display string. You can access it through bar.setString