Skip to content

Commit

Permalink
封装例子
Browse files Browse the repository at this point in the history
  • Loading branch information
ll committed Jul 14, 2021
1 parent b94d727 commit e3beee5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
8 changes: 4 additions & 4 deletions example/wxpython/超级列表框封装测试.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ def 按钮7_被单击(self, event):
filepath = efun.路径优化(r"C:\efun_view_system\resources\images\组件图标/" + v + ".png")
if efun.文件是否存在(filepath) == False:
filepath = efun.路径优化(r"C:\efun_view_system\resources\images\组件图标/默认.png")
il_max = self.图片组.加入图片(filepath, 32, 32)
il_max = self.图片组.加入图片(filepath)
k = k + 1
self.超级列表框1.置图片组(self.图片组, wx.IMAGE_LIST_NORMAL) # 加入图片组
k = 0
Expand All @@ -122,7 +122,7 @@ def 按钮8_被单击(self, event):
filepath = efun.路径优化(r"C:\efun_view_system\resources\images\组件图标/" + v + ".png")
if efun.文件是否存在(filepath) == False:
filepath = efun.路径优化(r"C:\efun_view_system\resources\images\组件图标/默认.png")
il_max = self.图片组.加入图片(filepath, 32, 32)
il_max = self.图片组.加入图片(filepath)
k = k + 1
self.超级列表框1.置图片组(self.图片组, wx.IMAGE_LIST_SMALL) # 加入图片组
k = 0
Expand All @@ -147,7 +147,7 @@ def 按钮9_被单击(self, event):
filepath = efun.路径优化(r"C:\efun_view_system\resources\images\组件图标/" + v + ".png")
if efun.文件是否存在(filepath) == False:
filepath = efun.路径优化(r"C:\efun_view_system\resources\images\组件图标/默认.png")
il_max = self.图片组.加入图片(filepath, 32, 32)
il_max = self.图片组.加入图片(filepath)
k = k + 1
self.超级列表框1.置图片组(self.图片组, wx.IMAGE_LIST_SMALL) # 加入图片组
k = 0
Expand Down Expand Up @@ -272,7 +272,7 @@ def 按钮14_被单击(self, event):
文件路径 = efun.路径优化(r"C:\efun_view_system\resources\images\组件图标/" + v + ".png")
if efun.文件是否存在(文件路径) == False:
文件路径 = efun.路径优化(r"C:\efun_view_system\resources\images\组件图标/默认.png")
il_max = self.图片组.加入图片(文件路径, 24, 24)
il_max = self.图片组.加入图片(文件路径)
k = k + 1
self.超级列表框1.置图片组(self.图片组, wx.图片组样式.小图标) # 加入图片组
k = 0
Expand Down
6 changes: 5 additions & 1 deletion pyefun/wxefun/component/wxImageList.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import wx

class 图片组类(wx.ImageList):
_宽度 = 64
_高度 = 64
def 加入图片(self, 文件路径, 宽度=0, 高度=0):
img = wx.Image(文件路径, wx.BITMAP_TYPE_ANY)
if 宽度 == 0:
img = img.Scale(64, 64)
img = img.Scale(self._宽度, self._高度)
else:
img = img.Scale(宽度, 高度)

Expand Down Expand Up @@ -42,4 +44,6 @@ def 替换(self, index, *__args):
return super().Replace(index, *__args)

def __init__(self, width=None, height=None, mask=True, initialCount=1):
self._宽度 = width
self._高度 = height
return super().__init__(width, height, mask, initialCount)

0 comments on commit e3beee5

Please sign in to comment.