Skip to content

Commit 08f72d7

Browse files
committed
2 parents 8a0462c + 30fc2c8 commit 08f72d7

File tree

4 files changed

+4021
-0
lines changed

4 files changed

+4021
-0
lines changed

chaoxi/Plotly-graph/Python-graph-lines.ipynb

Lines changed: 3756 additions & 0 deletions
Large diffs are not rendered by default.

chaoxi/Women/women_code.py

Lines changed: 177 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,177 @@
1+
import random
2+
import turtle as t
3+
4+
list1 = []
5+
for i in range(5):
6+
list1.append(int(random.uniform(-500, 500)))
7+
list2 = []
8+
for i in range(5):
9+
list2.append(int(random.uniform(-200, -50)))
10+
list3 = []
11+
for i in range(8):
12+
list3.append(int(random.uniform(-400, 400)))
13+
list4 = []
14+
for i in range(8):
15+
list4.append(int(random.uniform(-150, -50)))
16+
list5 = []
17+
for i in range(7):
18+
list5.append(int(random.uniform(-300, 300)))
19+
list6 = []
20+
for i in range(7):
21+
list6.append(int(random.uniform(-200, -100)))
22+
list7 = []
23+
for i in range(18):
24+
list7.append(int(random.uniform(-500, 500)))
25+
list8 = []
26+
for i in range(18):
27+
list8.append(int(random.uniform(-100, 100)))
28+
29+
# 画大号爱心(位置随机)
30+
for x, y in list(zip(list1, list2)):
31+
t.penup()
32+
t.goto(x, y)
33+
t.pendown()
34+
t.fillcolor("#FF6A6A")
35+
t.begin_fill()
36+
t.pencolor("#FF6A6A")
37+
t.forward(40)
38+
t.circle(20, 180)
39+
t.right(90)
40+
t.circle(20, 180)
41+
t.forward(40)
42+
t.end_fill()
43+
t.penup()
44+
t.goto(x, y)
45+
# 画中号爱心(位置随机)
46+
for x, y in list(zip(list5, list6)):
47+
t.pendown()
48+
t.fillcolor("#FFA07A")
49+
t.begin_fill()
50+
t.pencolor("#FFA07A")
51+
t.forward(30)
52+
t.circle(15, 180)
53+
t.right(90)
54+
t.circle(15, 180)
55+
t.forward(30)
56+
t.end_fill()
57+
t.penup()
58+
t.goto(x, y)
59+
# 画小号爱心(位置随机)
60+
for x, y in list(zip(list3, list4)):
61+
t.pendown()
62+
t.fillcolor("#FFD39B")
63+
t.begin_fill()
64+
t.pencolor("#FFD39B")
65+
t.forward(20)
66+
t.circle(10, 180)
67+
t.right(90)
68+
t.circle(10, 180)
69+
t.forward(20)
70+
t.end_fill()
71+
t.penup()
72+
t.goto(x, y)
73+
# 画点点(位置随机)
74+
for x, y in list(zip(list7, list8)):
75+
t.pendown()
76+
t.fillcolor("#FF6A6A")
77+
t.begin_fill()
78+
t.pencolor("#FF6A6A")
79+
t.circle(3, 360)
80+
t.end_fill()
81+
t.penup()
82+
t.goto(x, y)
83+
84+
85+
def DegreeCurve(n, r, d=1):
86+
for i in range(n):
87+
t.left(d)
88+
t.circle(r, abs(d))
89+
90+
91+
# 初始位置设定
92+
s = 0.2
93+
# t.setup(450*5*s, 750*5*s)
94+
t.pencolor("black")
95+
t.fillcolor("#FF4040")
96+
t.speed(100)
97+
t.penup()
98+
t.goto(0, 900 * s)
99+
t.pendown()
100+
# 绘制花朵形状
101+
t.begin_fill()
102+
t.circle(200 * s, 30)
103+
DegreeCurve(60, 50 * s)
104+
t.circle(200 * s, 30)
105+
DegreeCurve(4, 100 * s)
106+
t.circle(200 * s, 50)
107+
DegreeCurve(50, 50 * s)
108+
t.circle(350 * s, 65)
109+
DegreeCurve(40, 70 * s)
110+
t.circle(150 * s, 50)
111+
DegreeCurve(20, 50 * s, -1)
112+
t.circle(400 * s, 60)
113+
DegreeCurve(18, 50 * s)
114+
t.fd(250 * s)
115+
t.right(150)
116+
t.circle(-500 * s, 12)
117+
t.left(140)
118+
t.circle(550 * s, 110)
119+
t.left(27)
120+
t.circle(650 * s, 100)
121+
t.left(130)
122+
t.circle(-300 * s, 20)
123+
t.right(123)
124+
t.circle(220 * s, 57)
125+
t.end_fill()
126+
# 绘制花枝形状
127+
t.left(120)
128+
t.fd(280 * s)
129+
t.left(115)
130+
t.circle(300 * s, 33)
131+
t.left(180)
132+
t.circle(-300 * s, 33)
133+
DegreeCurve(70, 225 * s, -1)
134+
t.circle(350 * s, 104)
135+
t.left(90)
136+
t.circle(200 * s, 105)
137+
t.circle(-500 * s, 63)
138+
t.penup()
139+
t.goto(170 * s, -30 * s)
140+
t.pendown()
141+
t.left(160)
142+
DegreeCurve(20, 2500 * s)
143+
DegreeCurve(220, 250 * s, -1)
144+
145+
# 绘制一个绿色叶子
146+
t.fillcolor('#00CD00')
147+
t.penup()
148+
t.goto(670 * s, -180 * s)
149+
t.pendown()
150+
t.right(140)
151+
t.begin_fill()
152+
t.circle(300 * s, 120)
153+
t.left(60)
154+
t.circle(300 * s, 120)
155+
t.end_fill()
156+
t.penup()
157+
t.goto(180 * s, -550 * s)
158+
t.pendown()
159+
t.right(85)
160+
t.circle(600 * s, 40)
161+
# 绘制另一个绿色叶子
162+
t.penup()
163+
t.goto(-150 * s, -1000 * s)
164+
t.pendown()
165+
t.begin_fill()
166+
t.rt(120)
167+
t.circle(300 * s, 115)
168+
t.left(75)
169+
t.circle(300 * s, 100)
170+
t.end_fill()
171+
t.penup()
172+
t.goto(430 * s, -1070 * s)
173+
t.pendown()
174+
t.right(30)
175+
t.circle(-600 * s, 35)
176+
177+
t.done()

moumoubaimifan/antforest/antForest.py

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
import time
2+
3+
from appium import webdriver
4+
from selenium.webdriver.common.by import By
5+
from selenium.webdriver.support.ui import WebDriverWait
6+
from selenium.webdriver.support import expected_conditions as EC
7+
8+
from appium.webdriver.common.touch_action import TouchAction
9+
10+
desired_capabilities = {
11+
'platformName': 'Android', # 操作系统
12+
'deviceName': '2a254a02', # 设备 ID
13+
'platformVersion': '10.0.10', # 设备版本号,在手机设置中查看
14+
'appPackage': 'com.eg.android.AlipayGphone', # app 包名
15+
'appActivity': 'AlipayLogin', # app 启动时主 Activity
16+
'noReset': True # 是否保留 session 信息 避免重新登录
17+
}
18+
19+
# 判断元素是否存在
20+
def is_element_exist_by_xpath(driver, text):
21+
try:
22+
driver.find_element_by_xpath(text)
23+
except Exception as e:
24+
return False
25+
else:
26+
return True
27+
28+
# 收取能量
29+
def collect_energy(driver, width, height):
30+
# 能量球可能出现的区域坐标
31+
start_x = 150
32+
end_x = 900
33+
start_y = 540
34+
end_y = 900
35+
36+
for x in range(start_x, end_x, 50):
37+
for y in range(start_y, end_y, 50):
38+
x_scale = int((int(x) / width) * width)
39+
y_scale = int((int(y) / height) * height)
40+
# 点击指定坐标
41+
TouchAction(driver).press(x=x_scale, y=y_scale).release().perform()
42+
print('能量收取完毕')
43+
44+
def search_energy(driver, width, height):
45+
46+
x = int((int(1000) / width) * width)
47+
y = int((int(1550) / height) * height)
48+
# 点击指定坐标
49+
TouchAction(driver).press(x=x, y=y).release().perform()
50+
time.sleep(1)
51+
is_collected = is_element_exist_by_xpath(driver, '//android.widget.Button[contains(@text, "返回我的森林")]')
52+
if is_collected:
53+
print('能量全部收集完毕')
54+
return
55+
56+
collect_energy(driver, width, height)
57+
search_energy(driver, width, height)
58+
59+
60+
61+
if __name__ == '__main__':
62+
63+
driver = webdriver.Remote('http://localhost:4723/wd/hub', desired_capabilities)
64+
print('支付宝启动')
65+
# 设置等待超时时间
66+
wait = WebDriverWait(driver, 60)
67+
68+
wait.until(EC.element_to_be_clickable((By.ID, 'com.alipay.android.phone.openplatform:id/more_app_icon'))).click()
69+
wait.until(EC.element_to_be_clickable((By.XPATH, '//android.widget.TextView[contains(@text, "蚂蚁森林")]'))).click()
70+
time.sleep(3)
71+
# 获取手机屏幕宽高
72+
width = int(driver.get_window_size()['width'])
73+
height = int(driver.get_window_size()['height'])
74+
75+
collect_energy(driver, width, height)
76+
77+
search_energy(driver, width, height)
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import pypandoc
2+
import pdfkit
3+
4+
# web to pdf
5+
pdfkit.from_url(['www.baidu.com','www.bing.com'],'search.pdf')
6+
7+
# html to pdf
8+
pdfkit.from_file('/Users/xx/Desktop/html/baidu.html', 'html2pdf.pdf')
9+
10+
# html to word
11+
output = pypandoc.convert_file('/Users/xx/Desktop/html/baidu.html', 'docx', outputfile="baidu.doc")

0 commit comments

Comments
 (0)