HOW TO CREATE A PIE BY USING PYTHON (PYGAL&LXML)

6 April 2021, Abdulhakim Altunkaya

In this article we will create a simple python pie to test our skills and learn new functions.

I am using python editor IDLE 3.9

To make a pie with python we will need to go through 3 steps:

1. Download Python full pack from internet
2. Download Python editor (like PYCHARM) or use default one(like IDLE)
3. Download Python modules

I already assume you have gone through first two steps, so we can jump on third one.

DOWNLOAD MODULES

The modules we will need to download are called LXML and PYGAL. Modules are well organized Classes in python. They are both for free and available on python website for download. PYGAL is needed for pie code, and LXML is needed to display(to render) our code on browser

Type “lxml download python” in your browser and go to python website. You’ll see “pip install lxml” on the up-right side of you window. Copy this text then go to your command prompt. In your command prompt paste the text and press enter.

this is a article image

You’ll see a download appearing and saying the module downloaded successfully.

Now, again go to your browser, type “pygal download python” and go to python website. Follow the same steps above, copy the text and paste it to your command prompt and press enter. Again, after seeing a successful completion note, we can move to next step.

WRITE YOUR CODE

On your text editor write a code like the one below. When starting your code, you’ll need to write “import pygal”. But you don’t have to write “import lxml”

this is a article image

Save it and run (on IDLE, you can run your code with F5 button.)

this is a article image