37,719
社区成员
发帖
与我相关
我的任务
分享
import wx,os,sys,string
# -*- coding: cp936 -*-
class InFrame(wx.Frame):
def __init__(self, parent, id):
wx.Frame.__init__(self, parent, id, '人机交互检索界面',
size=(800, 670))
panel = wx.Panel(self)
self.sampleList3 = ['不确定','二叉形', '新月形','心形或卵形','圆形','近圆形',
'卵圆形','椭圆形','圆球状','圆柱状','披针形','梭形','齿形',]
wx.StaticText(panel, -1, "细胞形态:", (15, 200))
self.choice3 = wx.Choice(panel, -1, (90, 198), choices=self.sampleList3,
name="CellsForm")
self.choice3.Bind(wx.EVT_CHOICE,self.OnChoice3)
def OnChoice3(self,event):
panel=wx.Panel(self)
img3=wx.Image('F:\自习室\python\picture\huxian.jpg',wx.BITMAP_TYPE_ANY).Scale(50,70)
show3=wx.StaticBitmap(panel,-1,wx.BitmapFromImage(img3),pos=(15,500))
if __name__ == '__main__':
app = wx.PySimpleApp()
frame = InFrame(parent=None, id=-1)
frame.Show()
app.MainLoop()
import wx,os,sys,string
# -*- coding: cp936 -*-
class InFrame(wx.Frame):
def __init__(self, parent, id):
wx.Frame.__init__(self, parent, id, '人机交互检索界面',
size=(800, 670))
panel = self.panel=wx.Panel(self)
self.sampleList3 = ['不确定','二叉形', '新月形','心形或卵形','圆形','近圆形',
'卵圆形','椭圆形','圆球状','圆柱状','披针形','梭形','齿形',]
wx.StaticText(panel, -1, "细胞形态:", (15, 200))
self.choice3 = wx.Choice(panel, -1, (90, 198), choices=self.sampleList3,
name="CellsForm")
self.choice3.Bind(wx.EVT_CHOICE,self.OnChoice3)
def OnChoice3(self,event):
panel=self.panel
img1=wx.Image('F:\自习室\python\picture\huxian.jpg',wx.BITMAP_TYPE_ANY).Scale(80,100)#这个地方我想把图片修改尺寸为(80,100),但在界面上显示的只是很小的一个图形,做不到啊
img2=wx.Image('F:\自习室\python\picture\liu.jpg',wx.BITMAP_TYPE_ANY).Scale(80,100)
if self.choice3.GetStringSelection().encode('gb2312')=='二叉形':
show1=wx.StaticBitmap(panel,-1,wx.BitmapFromImage(img1),pos=(15,500))
if self.choice3.GetStringSelection().encode('gb2312')=='新月形':
show2=wx.StaticBitmap(panel,-1,wx.BitmapFromImage(img2),pos=(15,500))
if __name__ == '__main__':
app = wx.PySimpleApp()
frame = InFrame(parent=None, id=-1)
frame.Show()
app.MainLoop()
[Quote=引用 9 楼 a590687 的回复:]
import wx,os,sys,string
# -*- coding: cp936 -*-
class InFrame(wx.Frame):
def __init__(self, parent, id):
wx.Frame.__init__(self, parent, id, '人机交互检索界面',
size=(800, 670))
panel = self.panel=wx.Panel(self)
self.sampleList3 = ['不确定','二叉形', '新月形','心形或卵形','圆形','近圆形',
'卵圆形','椭圆形','圆球状','圆柱状','披针形','梭形','齿形',]
wx.StaticText(panel, -1, "细胞形态:", (15, 200))
self.choice3 = wx.Choice(panel, -1, (90, 198), choices=self.sampleList3,
name="CellsForm")
self.choice3.Bind(wx.EVT_CHOICE,self.OnChoice3)
def OnChoice3(self,event):
panel=self.panel
img3=wx.Image('F:\自习室\python\picture\huxian.jpg',wx.BITMAP_TYPE_ANY).Scale(50,70)
show3=wx.StaticBitmap(panel,-1,wx.BitmapFromImage(img3),pos=(15,500))
if __name__ == '__main__':
app = wx.PySimpleApp()
frame = InFrame(parent=None, id=-1)
frame.Show()
app.MainLoop()
import wx,os,sys,string
# -*- coding: cp936 -*-
class InFrame(wx.Frame):
def __init__(self, parent, id):
wx.Frame.__init__(self, parent, id, '人机交互检索界面',
size=(800, 670))
panel = self.panel=wx.Panel(self)
self.sampleList3 = ['不确定','二叉形', '新月形','心形或卵形','圆形','近圆形',
'卵圆形','椭圆形','圆球状','圆柱状','披针形','梭形','齿形',]
wx.StaticText(panel, -1, "细胞形态:", (15, 200))
self.choice3 = wx.Choice(panel, -1, (90, 198), choices=self.sampleList3,
name="CellsForm")
self.choice3.Bind(wx.EVT_CHOICE,self.OnChoice3)
def OnChoice3(self,event):
panel=self.panel
img3=wx.Image('F:\自习室\python\picture\huxian.jpg',wx.BITMAP_TYPE_ANY).Scale(50,70)
show3=wx.StaticBitmap(panel,-1,wx.BitmapFromImage(img3),pos=(15,500))
if __name__ == '__main__':
app = wx.PySimpleApp()
frame = InFrame(parent=None, id=-1)
frame.Show()
app.MainLoop()
# -*- coding:utf-8 -*-
import wx,os,sys,string
# -*- coding: cp936 -*-
class Ipanel(wx.Panel):
def __init__(self, parent):
wx.Panel.__init__(self, parent, -1)
self.sampleList3 = ['不确定','二叉形', '新月形','心形或卵形','圆形','近圆形',
'卵圆形','椭圆形','圆球状','圆柱状','披针形','梭形','齿形',]
Text = wx.StaticText(self, -1, "细胞形态:", (15, 200))
self.choice3 = wx.Choice(self, -1, (90, 198), choices=self.sampleList3,
name="CellsForm")
self.choice3.Bind(wx.EVT_CHOICE,self.OnChoice3)
#------
self.sizer = wx.BoxSizer(wx.HORIZONTAL)
self.SetSizer(self.sizer)
self.sizer.Add(Text, 0, wx.TOP, 20)
self.sizer.Add(self.choice3, 0, wx.ALL, 15)
self.pl = wx.Panel(self, -1, size=(300, 300))
self.MakePanel2(self.pl)
self.sizer.Add(self.pl, 0, wx.ALL|wx.EXPAND, 15)
self.TR = True
#给你点提示
def OnChoice3(self, evt):
if self.TR:
self.pl.Show(self.TR)
self.TR = False
else:
self.pl.Show(self.TR)
self.TR = True
self.Layout()
def MakePanel2(self, panel):
img3=wx.Image('a.jpg',wx.BITMAP_TYPE_ANY).Scale(300,300)
show3=wx.StaticBitmap(panel,-1,wx.BitmapFromImage(img3), size=(300, 300))
self.pl.Show(False)
class InFrame(wx.Frame):
def __init__(self):
wx.Frame.__init__(self, None, -1, '人机交互检索界面',
size=(800, 670))
panel = Ipanel(self)
if __name__ == '__main__':
app = wx.PySimpleApp()
frame = InFrame()
frame.Show()
app.MainLoop()