3 Star 0 Fork 0

lzq1357 / Modifying pictures

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
OperationFrame.py 1.95 KB
一键复制 编辑 原始数据 按行查看 历史
lzq1357 提交于 2021-07-26 23:15 . UI优化补充
"""
选择操作
展示几何变换、绘制图形、添加图标、添加滤镜、视觉效果等操作供用户选择
并根据用户选择,切换活动窗口内容
# lzq #
"""
from tkinter import *
from PIL import Image, ImageTk
import UI
class OperationFrame(Frame):
lastHeight = 0
canv = None
varFrm = None
logo = None
def __init__(self, canv, master=None):
self.canv=canv
Frame.__init__(self, master, relief=RAISED, borderwidth=2, bg=UI.bg, width=105, height=655)
logo = Image.open("img\\logo.jpg").resize((102,85))
self.logo = ImageTk.PhotoImage(logo)
Label(self, image=self.logo, width=105, height=90).place(x=0,y=0)
Label(self, text=UI.soft_name,
bitmap=UI.viewBmp, compound='left',
width=UI.leftWidth-10, height=18
).place(x=0,y=90)
self.lastHeight = 115
for key in UI.varFrms:
self.addFunction(key, UI.varFrms[key])
pass
#self.addButton()
def addFunction(self, funcName, funcFrm):
bcolor = UI.bg
fcolor = UI.fg
pw = UI.leftWidth-12
ph = 25
f = UI.font
dy = ph+8
btn = Button(self, text=funcName,
bg=bcolor, fg=fcolor,
bitmap=UI.viewBmp, compound='left',
width=pw, height=ph,
font=f,
command=lambda:self.replace(funcFrm))
btn.place(x=0, y=self.lastHeight)
self.lastHeight += dy
pass
def replace(self, newFrm):
"""
替换右侧的操作面板
"""
self.canv.unbind("<Button-1>")
self.canv.unbind("<ButtonPress-1>")
self.canv.unbind("<B1-Motion>")
self.canv.unbind("<ButtonRelease-1>")
self.canv.unbind("<Double-Button-1>")
if self.varFrm is not None:
self.varFrm.close()
newFrm.show()
self.varFrm = newFrm
Python
1
https://gitee.com/lzq1357/Modifying-pictures.git
git@gitee.com:lzq1357/Modifying-pictures.git
lzq1357
Modifying-pictures
Modifying pictures
master

搜索帮助