Do as suggested above, and then make sure to have a copy of PHP objects, Patterns,and Practice by Matt Zandstra. This book have a really good example of the design pattern concept. If you read the book, you can take a look at his smarty sample of implementation, but it is not the ultimate guide. There are available template engines out there that can be more comfortable for you to use. I was going to recommend the first book I have when I was 16, but I don't have it in front of me right now, sadly I can't even remember the title and the author. It is the one that have a waffle griddle on the cover.
In addition, while you are venturing into the OOP side, make sure to take the templating engine with it. By doing this, the view aspect of your application will be completely isolated from the application's logic.
Read more about the singleton pattern. The reason we need singleton pattern in PHP because as you master the OOP concepts, you will realize that , you need to write more classes for different aspects of your application. As your application classes increases in number, you will need to have a form of control or at least knowing which of those classes are intantiated ( at the least). By using Singleton Pattern, you can ( at least) control how the classes are instantiated. For example, if an instance of class One is present, then singleton will not create another instance of it, but rather set an instance of the class class required by your application. So, the idea is simple. One instance at a time.
The next steps after mastering the OOP is to go ahead into to the simple MVC design pattern. You can search online on how to build an extremely simple MVC with templating engine already included.
root = tkinter.Tk()
buttons=[i for i in range(10)]
#If specific button is pressed, output "YES"
for num in buttons: