Autoresize to content

I am new to python. I first tried programming during the covid period (from idleness). I chose Python (a very beautiful language). In three months without courses and training, I wrote two programs for personal use using code examples. I have two questions.

1 how to build language learning? What algorithm is needed to make it automatic (машинально). I am using VS Code. Great platform, but so far it looks like a bit of a mess. There is no order, no orderly system. Can you suggest an algorithm for writing code? How to make writing code become automatic? Google translate translates the word “машинальный” as automatic. This is an incorrect translation. The mechanical is a conscious technological process, but not automatic (unconscious process, instinct).

2 I’m trying to write a program. Recognition of text in a picture (pytesseract), translation into Russian and display of the translation in a window. The window should be without scrolls. The window adjusts to the content. In the case of pictures, this is possible. But how to do it with text?

Do you mean that you want a program to write code for you? Or do you mean that you want to get better at programming, so that you do not have to think so hard about it?

An image has a height and width in pixels, that are built into the concept. But text is one-dimensional by nature, and does not have a “physical size”. You need to choose how it is wrapped into lines, and figure out the physical dimensions, depending both on the text itself and the font that you use to write it. Depending on the library, some of this may be harder or easier, or already implemented.

One of the reasons why Python was created is to force people to write code now. You looked into this world and your hands itched. It is known that some people who complete programming courses end up not being able to write their first code. I am an ordinary mechanic, I deal with cars. Without courses, I managed to write my first code. I surprised myself. (By the way, if you type “self” on the Russian keyboard, then this is “ыуда”. Judas. Who is Judas in history - you know :)).)

My actions are spontaneous. I ask you: how to build an algorithm so that the code is written easier and more thoughtfully, so as not to waste time on video courses and the like?

Fine. I bring a screenshot. One guy wrote such a program. I don’t know what programming language. Is this possible in Python? Autoresize to content?