Advertisement

Pythontkinter用于展示snipaste截图的功能

阅读量:

说明本文采用

Snipaste作为一款性能优异的截图软件,其图像展示功能为本文提供了参考依据,文中采用tkinter技术实现了图像的可视化呈现,所展示的图像支持拖动操作,并可进行等比例缩放。

TK实现自定无边框边缘鼠标操作

复制代码
    import tkinter as tk
    import win32api
    import win32con
    from PIL import ImageTk, Image
    
    
    class MyApplication:
    def __init__(self):
        self.root = tk.Tk()
        self.root.overrideredirect(True)
        image_file = 'example.png'
        self.img = ImageTk.PhotoImage(Image.open(image_file))
        print(self.img.width, self.img.height)
        self.canvas = tk.Canvas(self.root, width=self.img.width(), height=self.img.height(), border

全部评论 (0)

还没有任何评论哟~