
做了一个简单的,不过没有用pylab。
理解下来,只要有图像能保存下来,就应该没问题,
# coding: utf-8import Tkinter as TK
from PIL import Image, ImageTk
def data_matplotlib():
import numpy as np
import matplotlibpyplot as plt
pltsavefig('tmppng')
return ImageTkPhotoImage(Imageopen('tmppng'))
# Definition
image = 'Hydrangeasjpg'
# Tkinter
root = TKTk()
roottitle('加载图形数据')
rootgeometry('1024x768+1+1')
rootupdate()
canvas = TKCanvas(root, width=1024, height=768, bg='green')
image_data = ImageTkPhotoImage(Imageopen(image))
canvascreate_image(0, 0, image=image_data, anchor=TKNW)
i = data_matplotlib()
canvascreate_image(100, 200, image=i, anchor=TKNW)
canvascreate_text(rootwinfo_width()/2, rootwinfo_height()/10,
text='Sample', font=('Arial', 18), fill='white')
canvaspack(side=TKTOP, expand=1, fill='both')
rootmainloop()
不过,使用中间还是有点难看,不知道哪位对matplotlib熟悉点的可以指教一下?
其实你只需要在tkinter嵌入外部浏览器软件即可,使用aardio语言创建浏览器(有示例),再嵌入到tkinter窗口中。
具体参考这篇文章
现在可以使用tkwebview2了,使用WebView2在tkinter中显示网页。
以上就是关于Python tkinter 在背景图片上怎么加pylab画出的图全部的内容,包括:Python tkinter 在背景图片上怎么加pylab画出的图、Python 如何用tkinter读取本地网页并显示在软件界面内、等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)