Python tkinter 在背景图片上怎么加pylab画出的图

Python tkinter 在背景图片上怎么加pylab画出的图,第1张

做了一个简单的,不过没有用pylab。

理解下来,只要有图像能保存下来,就应该没问题,

# coding: utf-8

import 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读取本地网页并显示在软件界面内、等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/zz/10128554.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2023-05-05
下一篇2023-05-05

发表评论

登录后才能评论

评论列表(0条)

    保存