Tag:python

  • Python: a detailed explanation of the example of vortex color control

    Time:2020-7-13

    turtle.pencolor(* args ) Returns or sets pencolor. Four input formats are allowed: pencolor() Returns the current pencolor as a color specification string or tuple (see example). Can be used as another input color of pencolor / fillcolor. pencolor(colorstring) Set pencolor to colorstring, which is a string specified by the color of TK, such as “red”, […]

  • Python installation tar.gz Detailed explanation of format file method

    Time:2020-7-11

    This article focuses on Python installation tar.gz Format file method in detail, the article through the example code introduced very detailed, for everyone’s study or work has a certain reference learning value, need friends can refer to Some libraries did not find the corresponding. WHL format file, only tar.gz Format file, and then summarize the […]

  • Using Python scripts to read data code instances from a file

    Time:2020-7-10

    This article mainly introduces how to use Python script to read data code from the file. This article introduces the example code in detail, which has certain reference value for everyone’s study or work, and friends in need can refer to it Recently, the progress of self-learning Python is relatively slow. After work, I look […]

  • Python twist Drawing Library & drawing name example

    Time:2020-7-7

    *****Take a look at the change() and run() functions I defined****** Drawing coordinate system: Function: set the size and position of the main form turtle.setup(width, height, startx, starty) #Width: the width of the window. If the value is an integer, it means the pixel value; if it is a decimal, it means the ratio of […]

  • Implementation of Gobang game in python (pyGame version)

    Time:2020-7-6

    This paper shares the specific code of Python Gobang game for your reference, the specific content is as follows catalog brief introduction Implementation process epilogue brief introduction Use Python to realize the Gobang game of pyGame; Environment: Windows system + python3.8.0 Rules of the game: 1. Divide into two players to fight, the default is […]

  • Use Python twist to draw Gao Da

    Time:2020-7-4

    I will not say much nonsense, directly on the code! import turtle t=turtle.Turtle() turtle.Turtle().screen.delay(0) tleft=turtle.Turtle() #Part one t.penup() t.goto(0,0) t.pendown() t.left(20) t.forward(110) t.left(25) t.forward(40) t.left(100) t.circle(180,20) t.right(120) t.forward(250) t.left(165) t.forward(250) t.right(100) t.forward(35) t.left(70) t.forward(45) t.left(70) t.forward(120) t.left(70) t.forward(80) t.left(80) t.forward(80) t.left(68) t.forward(120) t.left(180) t.forward(78) t.right(68) t.forward(60) t.right(75) t.forward(60) t.right(110) t.forward(15) t.left(38) t.forward(65) t. The straight […]

  • Python realizes serialization and reading of CSV file

    Time:2020-7-3

    This article mainly introduces the python implementation of serialization and CSV file reading, the article through the example code is very detailed, for everyone’s study or work has a certain reference learning value, need friends can refer to 1、 Python serialization: Serialization refers to the conversion of an object into a “serialized” data form, which […]

  • Explain the use of the subplot function in Python Matplotlib

    Time:2020-7-1

    In Python matplotlib.pylot We are more commonly used, the function is also a good package. The basic framework is relatively simple, but it is necessary to find some functions on the Internet to make a picture with perfect functions and nice looking. So, in order to save time, it can be done once and for […]

  • Using venv in Python 3 to create virtual environment in Ubuntu

    Time:2020-7-1

    1. The virtual environment follows the project and creates a virtual environment for a single project (pipeinstall virtualenv) 1. Create project directory: (find a directory) mkdir PythonProject cd PythonProject 2. Create the virtual environment env: Python – M venv env 3. Activate virtual environment: source env / bin / act 4. Install package and create […]

  • Using Python Matplotlib to draw box diagram and subgraph to solve the problem of coordinate axis label overlapping

    Time:2020-6-30

    When drawing with Matplotlib, the label of the coordinate axis is too long and overlapped. This paper mainly shows the solutions that are easy to use after testing. I hope it can also help you. For example, there is overlap in the original drawing, such as Figure 1: The code is: data1=[[0.3765,0.3765,0.3765,0.3765,0.3765],[0.3765,0.3765,0.3765,0.3765,0.3765],[0.3765,0.3765,0.3765,0.3765,0.3765],[0.3765,0.3765,0.3765,0.3765,0.3765]] data2=[[0.2985,0.2268,0.2985,0.2996,0.2985],[0.2022,0.3203,0.3141,0.2926,0.2681],[0.2985,0.2668,0.2786,0.2985,0.2985],[0.2985,0.2985,0.2984,0.2978,0.2966]] data3=[[0.7789,0.7698,0.6999,0.7789,0.7789],[0.7788,0.7758,0.7768,0.7698,0.8023],[0.7789,0.7781,0.7789,0.7789,0.7789],[0.7789,0.7782,0.7752,0.7852,0.7654]] Data4 […]

  • Analysis of init instance method of Python constructor

    Time:2020-6-29

    This article mainly introduces the analysis of init instance method of Python constructor. The example code is introduced in detail in this article, which has certain reference value for your study or work. You can refer to the following for your friends 1、 To create an object, we need to define a constructor__ init__ () […]

  • Methods of installing and uninstalling Python virtual environment and problems encountered

    Time:2020-6-29

    Ubuntu 16.04 install and uninstall pip Experimental environment Ubuntu16.04;VMware15; Problem description The author installed ubuntu16.04 on the virtual machine. After a period of time, I reopened it to compile the python program. When installing the required package, PIP PIP3 pointed to python2.7; [email protected]:~$ pip3.5 -V pip 19.1.1 from /usr/local/lib/python2.7/dist-packages/pip (python 2.7) [email protected]:~$ pip -V pip […]