Some of you may have heard of Python; it is currently the most popular programming language, even surpassing Java and C at times.Don’t be fooled by the hype around Python online; as long as you master the basic operations, you too can create various interesting effects.Today, I will introduce Python and its specific applications to help everyone better use Python to achieve more effects and creativity in their portfolios.|This Session’s Mentor|
Darren
Beijing Campus of Han Yi International, Industrial Interaction Department, Basic Software InstructorBachelor of Computer Science and Technology, University of Technology SydneyWebsite Operator and Designer at La Strada#1 Let’s Start with Understanding Python The advantage of Python lies in its simplicity and ease of use, allowing even those without programming backgrounds to create desired artistic forms in a short time. Additionally, as a free programming language, everyone can freely modify and use it, making our production convenient.Python Official Website: www.python.orgPython has many “libraries”, and the standard library is very large, providing a wide range of components.This library contains multiple built-in modules (written in C) that Python programmers must rely on to achieve system-level functionalities, such as file I/O.Additionally, there are many modules written in Python that provide standard solutions for many issues encountered in daily programming.Some of these modules are specifically designed to encourage and enhance the portability of Python programs by abstracting specific platform functionalities into platform-neutral APIs.Next, I will introduce two very interesting libraries: the “you-get” library, which is mainly used for downloading videos from certain websites, similar to a web scraping operation; and the “turtle” library, which can be used for drawing operations.#2 Using the “you-get” Library To help everyone correctly download Python and set up the usage environment, let’s first look at the precautions during the download process.On the Python official website, we need to find the Download section; after clicking, we will see the download interface. We can select the required installation package based on our computer’s operating system. Note that the default download on the Python official website is for Windows, so Mac users should select the appropriate installation package.Also, make sure to check the option “Add Python 3.9 to PATH”, as this will add Python’s path to our computer, making it easier to use when installing the interpreter later. Then just follow the preset steps to install.Once the Python environment is set up, we can start operating. First, use the win key + R on the keyboard to bring up the run window and enter the command “cmd”, then click enter or OK.After completing the above steps, we will see a black DOS command window. At this point, type “Python” and press enter to check if Python has been installed. If the interface looks like the image below, it indicates that the installation has been completed. “》》》” indicates that we can use Python to write and test simple code.Next, we close the window and repeat the previous steps to open this black command window again, then enter “pip3 install you-get” to install our you-get library.If it displays the image below, it indicates that the installation has been completed.Next, I will demonstrate how to use the code to download videos from websites. Here, we will use a video from Kang Shishi on Bilibili as an example.Kang Shishi’s video: https://www.bilibili.com/video/BV1K64y1R7Xr?from=search&seid=16740536659472768146&spm_id_from=333.337.0.0 First, open the video and copy the website link or share link above. Next, we open the black command window and enter the command: you-get, making sure to add a space followed by the website’s video link.We can observe the download process; the white box shows the code, and the following is the video link. After the download is complete, the yellow box shows the Windows system’s download path.The most interesting part of the you-get library is that the Bilibili video’s bullet comments will also be saved, and if there is a corresponding playback software, the comments can also be played after downloading. If students want to play videos in their works or download videos for creative inspiration but do not have download links, this method can be used to download them.
Han Yi student Z used the bullet comment feature as inspiration for their projectReceived an offer for RCA Visual Communication MA#3 Using the “turtle” Library Let’s learn about the turtle library, also known as the turtle graphics library, which draws shapes by generating a small turtle that leaves a trail on the screen.In addition to drawing shapes using turtle, Python can also be used for programming AI, automation, web scraping, etc.Below, we will use drawing a circle as an example to introduce how to draw with Python.We have already installed the Python programming language, so let’s find the Python folder from the program and open IDLE.Then, open a new file and start creating.We can first try the simplest two lines of code: Import turtle as t, which means importing the turtle library and abbreviating it as t, making it much simpler to write. The second line of code is: t.circle(30), which means to draw a circle with a size of 30. Let’s run it and see the effect.Next, let’s try the following few lines of code and see the running effect.This is the running effect.The numbers and values in the code t.right() and t.circle() can be changed, and altering them will yield different effects, as shown in the image below.This concludes the introduction of some functions in the turtle library and the randomly created graphic animations. Everyone can try to draw some simple shapes based on the steps.Besides Python, there are other programming languages like Processing that are suitable for students. Everyone can try hands-on operations to discover different creative effects.Usually, you can also try to combine these technologies with our artistic creations. This not only showcases our comprehensive abilities during school applications but also aligns with the current development background of the integration of technology and art.Get More Skills!▼