controlling the char size. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

controlling the char size.

i need a help on controlling the size of a char. i want all of my printed chars in a string be in a particular size. for example in the spaces size are not equal in phone and computer or in computer the size of a slash"/" is not equal with the size of a "|" or a dot".". I need it for this code: #start size=int(input('''in the size: ''')) mid=round((size+0.1)/2)-1 format=[''' ''' for x in range(size)] def up(): for i in range(mid): format[i]=('''|'''+''' '''*mid+'''#'''+''' '''*mid)*size+'''|''' def center(): format[mid]=('''|'''+'''#'''*size)*size+'''|''' def below(): for i in range(mid+1,size): format[i]=('''|'''+''' '''*mid+'''#'''+''' '''*mid)*size+'''|''' up() center() below() for i in range(size): print('''|'''+'''-'''*(len(format[0])-2)+'''|''') print('''\n'''.join(format)) print('''|'''+'''-'''*(len(format[0])-2)+'''|''') #end all lines should end in one place, but it don't. ill appreciate if you help me on this problem.

9th Apr 2019, 10:11 AM
alireza
alireza - avatar
4 Answers
+ 2
You mean you want to format text like you would in a text editor like Word? Make it look pretty? You can't do it in the terminal. You'd have to write a graphical user interface program for it. For example you can use tkinter which comes with Python. There you can control fonts, sizes, colors and so on... (You can't do that on Sololearn though.)
9th Apr 2019, 10:35 AM
HonFu
HonFu - avatar
+ 2
But that is automatically the case in console programs! In what setting are you outputting text with Python?
9th Apr 2019, 11:44 AM
HonFu
HonFu - avatar
0
No you didn't get my mean. I mean that all chars be in one size,for instance, if a sharp in bigger than a slash i need to increase slash's width to become as long as sharp.
9th Apr 2019, 11:41 AM
alireza
alireza - avatar
0
I need it for this code: #start size=int(input('''in the size: ''')) mid=round((size+0.1)/2)-1 format=[''' ''' for x in range(size)] def up(): for i in range(mid): format[i]=('''|'''+''' '''*mid+'''#'''+''' '''*mid)*size+'''|''' def center(): format[mid]=('''|'''+'''#'''*size)*size+'''|''' def below(): for i in range(mid+1,size): format[i]=('''|'''+''' '''*mid+'''#'''+''' '''*mid)*size+'''|''' up() center() below() for i in range(size): print('''|'''+'''-'''*(len(format[0])-2)+'''|''') print('''\n'''.join(format)) print('''|'''+'''-'''*(len(format[0])-2)+'''|''') #end all lines should end in one place, but it dont
9th Apr 2019, 12:19 PM
alireza
alireza - avatar