This repository has been archived by the owner on Oct 15, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
test.py
91 lines (73 loc) · 2.26 KB
/
test.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
# -*- coding: utf-8 -*-
import datetime
import json
import random
import cv2
from PIL.ImageDraw import ImageDraw
from PIL import ImageFont
from PIL import Image
from PIL import ImageDraw
from mirai import GroupMessage, At
from mirai.models import Image as mImage
from plugins.RandomStr.RandomStr import random_str
from plugins.dictPicDown import dict_download_img
from PIL import Image
import plugins
from plugins import weatherQuery
from plugins.blueArchiveGacha import gacha
from plugins.picGet import pic
from plugins.weatherQ import weatherQ
def weather(city):
import requests
from plyer import notification
"""
plyer是用来显示弹窗的模块
安装命令:pip install plyer
"""
params = {
"key": "SeSI8hL-BdFhE9MKb",
"location": city, # 查询地点设置为访问IP所在地
"language": "zh-Hans",
"unit": "c",
}
url = "https://api.seniverse.com/v3/weather/now.json"
# 获取数据
r = requests.get(url, params=params)
# 解析数据
data = r.json()["results"]
address = data[0]["location"]['path'] # 地点
temperature = data[0]['now']["temperature"] # 温度
text = data[0]['now']["text"] # 天气情况
# 弹窗显示消息
message = address + " 当前天气:\n" + \
"温度:" + temperature + "℃" + \
"\n天气情况:" + text + \
"\n祝您心情愉悦!(^o^)"
return message
"""
标题为“当前天气”
显示10秒钟(timeout参数)
"""
'''notification.notify(title="当前天气",
message=message,
timeout=10)'''
def main():
time = datetime.datetime.now().strftime('%Y-%m-%d')
print(time)
def picMaker():
#批量格式化签到背景图片
name=1
while name<299:
layer = Image.open('pictures/set1.png')
bg = Image.open('pictures/backGround/' + str(name) + '.jpg')
(x, y) = layer.size
out = bg.resize((x, y))
out.save('bg.png')
bg = Image.open('bg.png')
# merge = Image.blend(st, st2, 0.5)
bg.paste(layer, (0, 0), layer)
bg.save('pictures/backGround/' + str(name) + '.jpg')
name+=1
print('ok')
if __name__ == '__main__':
pic()