Jump to content
!-->
  • Join-Us

    https://metin2.dev is the 1st international community on Metin2 development. Join us to develop your skills and share your knowledge with the community, respectful and ethical forum.

  • 0

Set Color in uiTextLine


Zeta

Question

How can i set color in this text?

 

self.skill1text1 = ui.TextLine()
self.skill1text1.SetParent(self.thin)
self.skill1text1.SetDefaultFontName()
self.skill1text1.SetPosition(15, 10)
self.skill1text1.SetText("123456)")
self.skill1text1.SetOutline()
self.skill1text1.Show()
Link to comment
Share on other sites

5 answers to this question

Recommended Posts

  • 0
  • Honorable Member

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

  • 0
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

  • 0

 

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


×
×
  • 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.