资源简介
NULL
博文链接:https://westice.iteye.com/blog/972648

代码片段和文件信息
#-*- coding:utf-8 -*-
‘‘‘
Created on 2011-3-22
@author: 123
‘‘‘
import wx
import random
#图片属性封装
class ImageProperty():
checked=False#被选中状态
def __init__(self):
randnum=-1
def setrandnum(selfnum):
self.randnum=num
def getrandnum(self):
return self.randnum
def setchecked(selfchecked):
self.checked=checked
def getchecked(self):
return self.checked
#选中状态转变
def checkedshift(self):
if self.checked:
self.checked=False
else:
self.checked=True
class Myframe(wx.frame):
gridwidth=10
gridheight=10
imagelist=[]#图片对象列表
imageProlist=[]#图片属性列表,代表哪一个图片
prevcheckedimageindex=-1#前一次选中的图片
checkedimageindex=-1#当前选中的图片
panel=None
def __init__(self):
wx.frame.__init__(selfNone-1“My frame“size=(540600))
self.panel=wx.Panel(self-1)
self.panel.Bind(wx.EVT_MOTIONself.onmove)
self.panel.Bind(wx.EVT_LEFT_DOWNself.onclickPanel)
self.Bind(wx.EVT_PAINTself.OnPaint)
wx.StaticText(self.panel-1“mousePos:“pos=(10534))
self.posCtrl=wx.TextCtrl(self.panel-1““pos=(80530))
fgs=wx.FlexGridSizer(cols=10hgap=3vgap=3)
for col in range(self.gridwidth):
for row in range(self.gridheight):
randnum=int(random.random()*5)
imagename=‘image‘+str(randnum)+‘.jpg‘
img1=wx.Image(imagenamewx.BITMAP_TYPE_ANY)
img1=img1.Scale(5050)#2 缩小图像
sb1=wx.StaticBitmap(self.panel-1wx.BitmapFromImage(img1))
sb1.Bind(wx.EVT_LEFT_DOWNself.onclickImage)
self.imagelist.append(sb1)
imageproperty=ImageProperty()
imageproperty.setrandnum(randnum)
self.imageProlist.append(imageproperty)
fgs.Add(sb1)
self.panel.SetSizerAndFit(fgs)
def onmove(selfevent):
pass
#pos=event.GetPosition()
#self.posCtrl.SetValue(“%s %s“%(pos.xpos.y))
def onclickPanel(selfevent):
pos=event.GetPosition()
self.posCtrl.SetValue(“%s %s“%(pos.xpos.y))
#置空一个位置
def setBlank(selfimageindex):
#处理imagelist
img1=wx.Image(‘image-1.jpg‘wx.BITMAP_TYPE_ANY)
img1=img1.Scale(5050)#2 缩小图像
self.imagelist[imageindex].SetBitmap(wx.BitmapFromImage(img1))
self.imageProlist[imageindex].setrandnum(-1)#空白图片用-1表示
#设置alpha
def setAlpha(selfimageindex):
#处理imagelist
imagename=‘image‘+str(self.imageProlist[imageindex].getrandnum())+‘.jpg‘
print ‘imagename:‘self.imageProlist[imageindex].getrandnum()
img1=wx.Image(imagenamewx.BITMAP_TYPE_ANY)
if self.imageProlist[imageindex]
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 3873 2011-03-22 20:49 image-1.jpg
文件 9802 2011-03-23 12:03 westiceWxproject.py
文件 8713 2011-03-22 15:31 image0.jpg
文件 10413 2011-03-22 15:31 image1.jpg
文件 12744 2011-03-22 15:32 image2.jpg
文件 15367 2011-03-22 15:32 image3.jpg
文件 9469 2011-03-22 15:32 image4.jpg
----------- --------- ---------- ----- ----
70381 7
相关资源
- 中文分词工具评测
- 抖音视频无水印核心源码
- IIs put上传工具
- python 连连看小游戏源码
- 100道Python练习题(附源码)
- python五子棋源码(控制台版本)
- dronet源码+论文(深度学习)
- 坦克大战带源码(python)
- 恐龙快跑 游戏源码(基于pygame)
- cs破解工具
- 教孩子学编程源码
- labelImg-1.8.1(图片标注工具)
- python学生管理系统源码(控制台)
- 缠论dll(czsc - 缠中说禅技术分析工具
- Tushare库打造股票筛选工具
- 自动截屏工具(python源码)
- python学生管理器源码
- 小说阅读项目源码(附数据库脚本)
- 美多商城源码(Python+Diango+Vue)
- QPA进程抓包工具
- 超级玛丽 python源码
- 玩我的世界学python编程源码
- 中山大学-自然语言处理-中文分词项目
- Python其它开发工具的安装与使用.ppt
- python爬虫爬取旅游信息(附源码,c
- 爬取上百张妹子图源码可直接运行
- python 井字棋 游戏源码
- Python源码剖析.pdf59505
- Python 串口工具源码+.exe文件
- 蓝奏云批量上传工具.zip
评论
共有 条评论