In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article focuses on "how to use the Mu editor Python", interested friends may wish to take a look. The method introduced in this paper is simple, fast and practical. Now let the editor take you to learn how to use Mu editor Python!
Start using Python's turtle module
On a Linux or macOS computer, all you have to do is open a terminal, type python, and you will see Python shell.
If you are using a Windows computer, you need to install Python first and download the latest stable version from Python.
Next, import the turtle module into Python using import turtle or import turtle as t. Then you can start to enjoy the fun of creating turtle drawings.
Meet Mu.
In the early days of my Python adventure, I used IDLE, an integrated development environment for Python. It's much easier than typing commands in Python shell, and I can write and save programs for later use. I took some online courses and read many excellent books about Python programming. I teach teachers and students how to use IDLE to create tortoise drawings.
IDLE is a big improvement, but I saw Nicholas Tollervey's speech on PyConUS 2019 in Cleveland, which changed the way I learned and taught Python. Nick is an educator who founded Mu, a Python editor designed specifically for young programmers (and even older programmers like me). Mu can be installed on Linux, macOS, and Windows. It is easy to use and comes with excellent documentation and tutorials.
On Linux, you can install Mu from the command line.
On Ubuntu or Debian:
$sudo apt install mu-editor
In Fedora or similar places:
$sudo dnf install mu
Alternatively, you can use Python for installation. First, make sure you have Python 3 installed:
$python-version
If you fail, try:
$python3-version
Assuming you have Python 3 or later, use the Python package manager pip to install Mu.
$python-m pip install mu-editor-user
Then you can run Mu from the command line, or create a shortcut:
$python-m pip install shortcut mu-editor-user
Mu is installed by default on the raspberry pie, which is a big advantage. Over the past few years, I have introduced students to Python programming using raspberry pie and Mu editors.
How to teach Python with Mu
Mu is a good way to show students an introduction to Python. Here is how I teach students to start using it.
(1) Open the Mu editor.
Mu editor
(2) enter import turtle to import the turtle module, you can make the tortoise move. My first lesson is to draw a simple square with Python code.
Mu editor
(3) Save the program and make sure the file name ends with .py.
Saving program in Mu
(4) run the program. Even running such a simple program can be exciting, and it's interesting to see the graphical output of the program you write.
Running Python program in Mu
Transcend basic knowledge
After this simple lesson, I explained that there are some ways to simplify and expand the basic knowledge that students have learned. One is to create a simpler turtle object, import turtle as t. Then I introduced a for loop and used another turtle method to draw a square.
For loops in Python with Mu
Next, I'll show you how to create a my_square function as another way to draw a square.
My_square function
Later, I extended this concept by introducing other turtle module methods, including penup, pendown, and pencolor. Soon, my students began to develop more complex programs and iterate over them.
At this point, I believe you have a deeper understanding of "how to use the Mu editor Python". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 224
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.