Jump to content
×
×
  • Create New...

Multi Textline


Recommended Posts

M2 Download Center

Download Here ( Internal )

 

Code:

class MultiTextLine(ui.TextLine):
	def __init__(self, parent, text, x, y, range = 15):
		ui.TextLine.__init__(self)
		
		self.TextList = []
		self.CreateUI(parent, text, x, y, range)
		
	def __del__(self):
		del self.TextList
		ui.TextLine.__del__(self)
	
	def CreateUI(self, parent, text, x, y, range):
		if "\n" in str(text):
			self.first_text = ui.TextLine()
			self.first_text.SetParent(parent)
			self.first_text.SetPosition(x, y)		
			self.first_text.SetText(text.split("\n")[0])
			self.first_text.Show()
			self.TextList.append(self.first_text)
			for i in xrange(text.count("\n")):
				self.i = ui.TextLine()
				self.i.SetParent(parent)
				self.i.SetPosition(x, (i + 1) * range + y)		
				self.i.SetText(text.split("\n")[i+1])
				self.i.Show()
				self.TextList.append(self.i)
				
	def SetText(self, text):
		tmpMiktar = 0
		if "\n" in str(text):				
			for i in self.TextList:
				if i == self.TextList[0]:
					i.SetText(text.split("\n")[0])
				else:
					i.SetText(text.split("\n")[tmpMiktar])
				tmpMiktar += 1
	
	def Close(self):
		for i in self.TextList: i.Hide()
		self.__del__()

Usage:

Syntax:
veriable = MultiTextLine(parent, text , x, y, range[optional])

Example:
self.TestText = MultiTextLine(self, 'Test1\nTest2\nTest3\nTest4\nTest5', 60, 35, 15)

 

  • Metin2 Dev 1
  • Love 7
  • Good 2
Link to comment
Share on other sites

  • 5 months later...

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


  • Activity

    1. 2

      Problem freebsd

    2. 0

      Making chain quest

    3. 4

      Ludus2: a metin2-like browser game

    4. 6
    5. 9

      Help in implementing a switch bot

    6. 0

      Special Inventory System Can't Sell To Npc's

    7. 0

      ROV2.GLOBAL | International | Server start 14.05.2022

    8. 75

      Services - System Ard [C ++ / Python / Lua]

  • Recently Browsing

    • No registered users viewing this page.

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.