billythegoat356 / pystyle

The source of my Python library, pystyle.
https://pypi.org/project/pystyle/
Eclipse Public License 2.0
199 stars 13 forks source link

Center.XCenter multi-line #18

Closed ambr0sial closed 2 years ago

ambr0sial commented 2 years ago

Is there a way to do multi-line with Center.XCenter without the text being left justified (I want my text to be middle aligned)?

billythegoat356 commented 2 years ago

Hello! There is in fact a way to do what you want! Just call the function Center.TextAlign with your variable as an argument! Then you can do whatever you want with it :)

ambr0sial commented 2 years ago

Hello! Thank you for your answer, however, maybe I'm doing something wrong, but it does the same as if I used Center.XCenter (Pystyle updated at the latest version, 2.0) Just in case, here is the code:

Write.Print(text=Center.TextAlign("You're currently using a beta version of Winter. If you notice any bugs, please report them to the developer."), color=Colors.red_to_white, interval=0.002) And also, I don't know if that changes something, but I used System.Size(100, 50)

Have a good day!

billythegoat356 commented 2 years ago

Hello again. Text align is used to align multiple lines, not just one. In your case, Center.XCenter should be working perfectly and shouldn't align to left since you have only one line. Can you show me your code with Center.XCenter so I can see what's causing the problem?

ambr0sial commented 2 years ago

It is only one line but is still left justified because it is automatically jumping one line because of the window size. I would like the "developer" that is in the second line to be centered in X position. image

Here's the first lines of the code:


System.Clear()
System.Title("Winter")
print('\n' * 2)
print(Colorate.Diagonal(color=Colors.blue_to_white, text=Center.XCenter(ascii_art)))
print('\n' * 2)
Write.Print(text=Center.TextAlign("You're currently using a beta version of Winter. If you notice any bugs, please report them to the developer."), color=Colors.red_to_white, interval=0.002)
print('\n' * 3)```
//other part of the code that isn't important
billythegoat356 commented 2 years ago

The problem here is that the size of the terminal is too small. Just put it bigger, it should correct the problem with Center.TextAlign !

ambr0sial commented 2 years ago

That was the size of the terminal. Thank you!