国产片侵犯亲女视频播放_亚洲精品二区_在线免费国产视频_欧美精品一区二区三区在线_少妇久久久_在线观看av不卡

腳本之家,腳本語(yǔ)言編程技術(shù)及教程分享平臺(tái)!
分類(lèi)導(dǎo)航

Python|VBS|Ruby|Lua|perl|VBA|Golang|PowerShell|Erlang|autoit|Dos|bat|

服務(wù)器之家 - 腳本之家 - Python - python使用PyGame繪制圖像并保存為圖片文件的方法

python使用PyGame繪制圖像并保存為圖片文件的方法

2020-06-12 10:24feiwen Python

這篇文章主要介紹了python使用PyGame繪制圖像并保存為圖片文件的方法,涉及Python使用PyGame操作圖片的相關(guān)技巧,需要的朋友可以參考下

本文實(shí)例講述了python使用PyGame繪制圖像并保存為圖片文件的方法。分享給大家供大家參考。具體實(shí)現(xiàn)方法如下:

?
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
''' pg_draw_circle_save101.py
draw a blue solid circle on a white background
save the drawing to an image file
for result see http://prntscr.com/156wxi
tested with Python 2.7 and PyGame 1.9.2 by vegaseat 16may2013
'''
import pygame as pg
# pygame uses (r, g, b) color tuples
white = (255, 255, 255)
blue = (0, 0, 255)
width = 300
height = 300
# create the display window
win = pg.display.set_mode((width, height))
# optional title bar caption
pg.display.set_caption("Pygame draw circle and save")
# default background is black, so make it white
win.fill(white)
# draw a blue circle
# center coordinates (x, y)
center = (width//2, height//2)
radius = min(center)
# width of 0 (default) fills the circle
# otherwise it is thickness of outline
width = 0
# draw.circle(Surface, color, pos, radius, width)
pg.draw.circle(win, blue, center, radius, width)
# now save the drawing
# can save as .bmp .tga .png or .jpg
fname = "circle_blue.png"
pg.image.save(win, fname)
print("file {} has been saved".format(fname))
# update the display window to show the drawing
pg.display.flip()
# event loop and exit conditions
# (press escape key or click window title bar x to exit)
while True:
  for event in pg.event.get():
    if event.type == pg.QUIT:
      # most reliable exit on x click
      pg.quit()
      raise SystemExit
    elif event.type == pg.KEYDOWN:
      # optional exit with escape key
      if event.key == pg.K_ESCAPE:
        pg.quit()
        raise SystemExit

希望本文所述對(duì)大家的Python程序設(shè)計(jì)有所幫助。

延伸 · 閱讀

精彩推薦
Weibo Article 1 Weibo Article 2 Weibo Article 3 Weibo Article 4 Weibo Article 5 Weibo Article 6 Weibo Article 7 Weibo Article 8 Weibo Article 9 Weibo Article 10 Weibo Article 11 Weibo Article 12 Weibo Article 13 Weibo Article 14 Weibo Article 15 Weibo Article 16 Weibo Article 17 Weibo Article 18 Weibo Article 19 Weibo Article 20 Weibo Article 21 Weibo Article 22 Weibo Article 23 Weibo Article 24 Weibo Article 25 Weibo Article 26 Weibo Article 27 Weibo Article 28 Weibo Article 29 Weibo Article 30 Weibo Article 31 Weibo Article 32 Weibo Article 33 Weibo Article 34 Weibo Article 35 Weibo Article 36 Weibo Article 37 Weibo Article 38 Weibo Article 39 Weibo Article 40
主站蜘蛛池模板: 国产欧美日韩精品一区 | 精品国产99| 91免费观看视频 | 国产精品日韩在线观看 | 黄色免费在线观看 | 午夜成人在线视频 | 偷拍自拍网 | 欧美中文字幕在线观看 | 女人夜夜春高潮爽av片 | 亚洲射情 | 北条麻妃在线一区二区 | 动漫羞免费网站中文字幕 | 亚洲三级电影 | 亚洲伦理| 亚洲一区在线观看视频 | 日韩欧美在线综合 | 久久精品中文字幕大胸 | 久久久亚洲国产美女国产盗摄 | 日韩中文字幕一区二区三区 | 亚洲va欧美va天堂v国产综合 | 九九九九精品九九九九 | 免费成人高清在线视频 | 成年免费视频 | 在线观看一区二区三区四区 | 久久精品国产99国产精2020新增功能 | 精品国产乱码久久久久久1区2区 | 影音先锋男人网 | 亚洲精品字幕 | 国产精品2区 | 亚洲 欧美 另类 综合 偷拍 | 黄片毛片 | 免费在线观看一区二区 | 日韩 欧美 中文 | 在线色网站 | 国产综合精品一区二区三区 | 成人午夜视频免费 | 亚洲一区二区三 | www,99热 | 一区二区三区不卡视频 | 亚洲日本在线观看视频 | 色播av|