Skip to content

Commit

Permalink
优化:子窗口滚轮调整透明度
Browse files Browse the repository at this point in the history
  • Loading branch information
hiroi-sora committed Apr 25, 2023
1 parent f838f41 commit ae880cf
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions ui/win_show_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,13 @@ def __onClickUnlock(self, e=None): # 单击解锁
def __onMouseWheel(self, e=None): # 滚轮
if self.isLock:
return
if e.state == 4: # Ctrl按下,调整透明度
print(e.state)
if e.state == 0: # 什么都不按,缩放
step = 30
s = step if e.delta > 0 else -step
w = self.wh[0]+s
self.__resize(w, 0)
else: # 按下任何修饰键(Ctrl、Shift等),调整透明度
step = 0.1
s = step if e.delta > 0 else -step
alpha = self.win.attributes('-alpha')
Expand All @@ -245,11 +251,6 @@ def __onMouseWheel(self, e=None): # 滚轮
if a > 1:
a = 1
self.win.attributes('-alpha', a)
else: # 否则,缩放
step = 30
s = step if e.delta > 0 else -step
w = self.wh[0]+s
self.__resize(w, 0)

# ============================== 功能 ==============================

Expand Down

0 comments on commit ae880cf

Please sign in to comment.