This is an app that will provide us with Facts. With Python, we can make things very easy. We have a very amazing library so that we can do it.
We just need two of the libraries and if we just combine the concept, we will be able to make a new thing. We just have to use tkinter and randfacts to do this so.
- Tkinter: The tkinter package (“Tk interface”) is the standard Python interface to the Tk GUI toolkit. It is an inbuilt module in python.
- RandFacts: Randfacts is a python library that generates random facts. You can use randfacts.getFact() to return a random fun fact. Use the below command to install this module in the system.
pip install randfacts
We have to import the libraries and make two buttons one for adding the facts and one for clearing the window.
Step 1) Importing the modules.
Step 2) Making the move function(For adding the facts)
Step 3) Making the destroy function for clearing the window
Step 3) Create the buttons in the driver code.
Below is the complete program based on the above approach:
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course.