Jump to content

Set Color in uiTextLine


Go to solution Solved by xP3NG3Rx,

Recommended Posts

self.skill1text1 = ui.TextLine()
self.skill1text1.SetParent(self.thin)
self.skill1text1.SetDefaultFontName()
self.skill1text1.SetPosition(15, 10)
self.skill1text1.AppendTextLine("Startgebot:" + str(NewStartGebot),grp.GenerateColor( (255.00 / 255) , (200.00 / 255), (72.00 / 255), 1.0))
self.skill1text1.SetOutline()
self.skill1text1.Show()
 
Like this?
 
it didn't work
 
'TextLine' object has no attribute 'AppendTextLine'
Link to comment
Share on other sites

  • Honorable Member
  • Solution

Jesus Christ.

AppendTextLine is a method of uiTooltip.Tooltip() class object.

 

You can use two methods of TextLine to make a colored line:

class TextLine(Window):
	def SetFontColor(self, red, green, blue):
		wndMgr.SetFontColor(self.hWnd, red, green, blue)

	def SetPackedFontColor(self, color):
		wndMgr.SetFontColor(self.hWnd, color)

The packed color is that what the grp module can generate to you with the GenerateColor method.

For example(lightgreen): packed_color = grp.GenerateColor(105./255, 1., 75./255, 1.)

 

Usage:

text = ui.TextLine()
#text.SetParent(self)
text.SetDefaultFontName()
text.SetPosition(16, 77)
text.SetPackedFontColor(grp.GenerateColor(105./255, 1., 75./255, 1.))
#text.SetFontColor(105/255., 255./255, 75./255)
text.SetText("This is a green message")
text.Show()
  • Love 1
Link to comment
Share on other sites

 

Jesus Christ.

AppendTextLine is a method of uiTooltip.Tooltip() class object.

 

You can use two methods of TextLine to make a colored line:

class TextLine(Window):
	def SetFontColor(self, red, green, blue):
		wndMgr.SetFontColor(self.hWnd, red, green, blue)

	def SetPackedFontColor(self, color):
		wndMgr.SetFontColor(self.hWnd, color)

The packed color is that what the grp module can generate to you with the GenerateColor method.

For example(lightgreen): packed_color = grp.GenerateColor(105./255, 1., 75./255, 1.)

 

Usage:

text = ui.TextLine()
#text.SetParent(self)
text.SetDefaultFontName()
text.SetPosition(16, 77)
text.SetPackedFontColor(grp.GenerateColor(105./255, 1., 75./255, 1.))
#text.SetFontColor(105/255., 255./255, 75./255)
text.SetText("This is a green message")
text.Show()

Thanks!!!

  • Love 1
Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

Announcements



×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.