python画一颗拳头大的💗】的更多相关文章

用上turtle库后,各种画,今天画个拳头大的爱心@.@. 下面贴下代码: # -*- coding: utf-8 -*- # Nola import pygame import time import turtle as t def heart(): # 添加播放音乐功能 file = 'Walk Off the Earth.Jocelyn Alice.Krnfx - Havana.mp3' #mp3的路径 pygame.mixer.init() # 初始化音频 track = pygame.…
import numpy as np import matplotlib.pyplot as plt x_coords = np.linspace(-100, 100, 500) y_coords = np.linspace(-100, 100, 500) points = [] for y in y_coords: for x in x_coords: if ((x * 0.03) ** 2 + (y * 0.03) ** 2 - 1) ** 3 - (x * 0.03) ** 2 * (y…
# -*- coding: utf-8 -*- # @Time : 18-12-26 上午9:32 # @Author : Felix Wang import turtle # 定义圣诞树的绿叶函数 def tree(d, s): if d <= 0: return turtle.forward(s) tree(d - 1, s * .8) turtle.right(120) tree(d - 3, s * .5) turtle.right(120) tree(d - 3, s * .5) tu…
沉淀再出发:用python画各种图表 一.前言 最近需要用python来做一些统计和画图,因此做一些笔记. 二.python画各种图表 2.1.使用turtle来画图 import turtle as t #turtle库是python的内部库,直接import使用即可 import time def draw_diamond(turt): for i in range(1,3): turt.forward(100) #向前走100步 turt.right(45) #海龟头向右转45度 turt…
因python自带有海龟画图库,尝试给爱猫的小仙女来画个猫咪. 1.代码如下 from turtle import * #两个函数用于画心 def curvemove(): for i in range(200): right(1) forward(0.1) def heart(x,y,s): pu() goto(x,y) seth(s) pendown() begin_fill() left(140) forward(11.1) curvemove() left(120) curvemove(…
python字符串操作实方法大合集,包括了几乎所有常用的python字符串操作,如字符串的替换.删除.截取.复制.连接.比较.查找.分割等,需要的朋友可以参考下:   #1.去空格及特殊符号 s.strip().lstrip().rstrip(',') #2.复制字符串 #strcpy(sStr1,sStr2) sStr1 = 'strcpy' sStr2 = sStr1 sStr1 = 'strcpy2' print sStr2 #3.连接字符串 #strcat(sStr1,sStr2) sS…
用python画简单的樱花 代码如下: import turtle as T import random import time # 画樱花的躯干(60,t) def Tree(branch, t): time.sleep(0.0005) if branch > 3: if 8 <= branch <= 12: if random.randint(0, 2) == 0: t.color('snow') # 白 else: t.color('lightcoral') # 淡珊瑚色 t.pe…
转自:python画个小猪佩奇 # -*- coding: utf-8 -*- """ Created on Mon May 20 11:36:03 2019 @author: epsoft """ import turtle as t def nose(x,y):#鼻子 t.pu() t.goto(x,y) t.pd() t.seth(-30) t.begin_fill() a=0.4 for i in range(120): if 0<…
用python画 pareto front 觉得有用的话,欢迎一起讨论相互学习~Follow Me 2D pf import os import matplotlib.pyplot as plt import numpy as np def Read_Files(filename): X_axis = [] # X Y_axis = [] # Y with open(filename, 'r') as f: for line in f.readlines(): x = line.split("…
用python画3D的高斯曲线,我想如果有多个峰怎么画? import numpy as npimport matplotlib.pyplot as pltimport mathimport mpl_toolkits.mplot3d x, y = np.mgrid[-2:2:200j, -2:2:200j]z=(1/2*math.pi*3**2)*np.exp(-(x**2+y**2)/2*3**2)ax = plt.subplot(111, projection='3d')ax.plot_su…