我的這塊戴爾S2340Mc屏,黑色時完全就是一面鏡子!為了當鏡子用,我需要一塊黑色。另外div中height設1000%是不行,參考height: 100% not working。
浮動無邊黑屏
#!/usr/bin/python3
# -*- coding: utf8 -*-
#dnf install python3-matplotlib
#pip install matplotlib,fire
#指定起始坐標xy、寬度、高度和顏色,來畫一個填充好的矩形
#為了遮擋盜版電影頂部和底部的賭城廣告
import fire,matplotlib
def drawRectangle(x='0',y='0',width='400',length='400',color='black'):
#"640x400+0+200"
conf = str(width) + 'x' + str(length) + '+' + str(x) + '+' + str(y)
# make sure Tk backend is used
matplotlib.use("TkAgg")
import matplotlib.pyplot as plt
# turn navigation toolbar off
plt.rcParams['toolbar'] = 'None'
plt.rcParams['figure.facecolor'] = color
# create a figure and subplot
fig, ax = plt.subplots(figsize=(2,2))
#remove margins
fig.subplots_adjust(0,0,1,1)
# turn axes off
ax.axis("off")
# show image
# im = plt.imread("black.png")
# ax.imshow(im)
# remove window frame
fig.canvas.manager.window.overrideredirect(1)
plt.get_current_fig_manager().window.wm_geometry(conf)
plt.show()
#drawRectangle('10','980')
if __name__ == '__main__':
fire.Fire(drawRectangle)
#默認在屏幕左上角生成一個400*400的黑屏 python drawRectangle.py #在左下角(0,980)生成一個128*72的紅屏 python drawRectangle.py 0 980 128 72 red
本文更新於 2018/07/23。