def __init__(self, text="", pos=(0, 0), size=(0, 0), color=0x0, bgcolor=0x0, outlinecolor=0x0, selectedOutLineColor=0x0, fontsize=15, limit=16): Control.__init__(self, pos, color, fontsize) self.text = text self.TextEditing = 0 #是否正在编辑文本 self.size = size self.bgcolor = bgcolor self.selectedOutLineColor = selectedOutLineColor self.outlinecolor = outlinecolor self.field = txtfield.New( (self.pos[0], self.pos[1], self.pos[0] + self.size[0], self.pos[1] + self.size[1]), cornertype=txtfield.ECorner1, txtlimit=limit) self.field.textstyle(u'', 140, 0x0, style=u'normal') self.field.bgcolor(self.bgcolor) self.field.add(self.text) self.field.select(0, len(self.text)) self.field.focus(0) self.field.visible(0)
def __drawQuery(s,list): s.__img.polygon(s.rim((13,130,227,160+len(list)*25)),fill=s.colour) s.__img.polygon(s.rim((13,130,227,160)),fill=s.colour) s.__img.polygon(s.rim((13,160+len(list)*25-2,227,160+len(list)*25+27)),fill=s.colour) if len(s.list)>5: s.__img.line((224,162,224,280),s.colour,width=3) s.__img.line((224,162+s.choice*(280.0-162)/(len(s.list)-5+1),224,162+(s.choice+1)*(280.0-162)/(len(s.list)-5+1)),s.colour+0x777777,width=3) s.__img.line((14,158,225,158),s.colour+0x777777,width=2) s.__img.line((14,160+len(list)*25-2,225,160+len(list)*25-2),s.colour+0x777777,width=2) s.__img.text((120-s.__img.measure_text(s.title,("dense",22))[0][2]/2.0,155),s.title,0x0,("dense",22,FONT_BOLD|FONT_ANTIALIAS)) s.__img.text((18,160+len(list)*25+25),'确定'.decode("u8"),0xff,("dense",20,FONT_BOLD|FONT_ANTIALIAS)) s.__img.text((240-18-44,160+len(list)*25+25),'取消'.decode("u8"),0xff,("dense",20,FONT_BOLD|FONT_ANTIALIAS)) if s.type=="query": for i in range(len(list)): s.__img.text((20,180+i*25),list[i],0x0,("dense",18,FONT_ANTIALIAS)) else: s.field=txtfield.New((20,170,220,150+len(list)*25),cornertype=txtfield.ECorner1,txtlimit=0) s.field.textstyle(u'',140,0xffffff,style=u'normal') s.field.bgcolor(s.colour) s.field.add(s.content) s.field.select(0,len(s.content)) s.field.focus(1) s.field.visible(1) s.__redraw() del list
def start(s): lang.set_predicative_input(0) s.window_search = txtfield.New((90, 295, 150, 320), txtlimit=7, callback=s.ws_cb) s.window_search.visible(1) s.window_search.focus(1) s.lb = appuifw.Listbox([ru('мама'), ru('папа'), ru('сестра')], s.lb_cb) appuifw.app.body = s.lb
def __init__(self, select_callback=None, double=0, icons=0): self.select_callback = select_callback self.double = double self.icons = icons self.lb = appuifw2.Listbox2(select_callback=self.callback, double=double, icons=icons) (a, b), (x, y) = appuifw2.app.layout(appuifw2.EControlPane) self.window_search = txtfield.New( (int(a / 2.5), 0, a - int(a / 2.5), b), txtlimit=5) self.window_search.visible(0) self.window_search.setpos(int(a / 2.5), y) self.window_search.bgcolor(0xffffff) self.list_lb = []
def preview(path): font = txtfield.LoadFont(path) txt = txtfield.New((5, 5, 170, 150), cornertype=txtfield.ECorner5) txt.textstyle(u'LatinBold13', size=250, style=u'normal', color=0x225522) txt.add(unicode(str(copyright))) e32.ao_sleep(2) txt.textstyle(u'LatinPlain12', size=250, style=u'normal', color=0x225522) txt.add(unicode(str(copyright))) e32.ao_sleep(2) txt.textstyle(u'LatinBold19', size=250, style=u'normal', color=0x225522) txt.add(unicode(str(copyright))) e32.ao_sleep(2) del txt print font txtfield.RemoveFont(font) e32.ao_sleep(0.6)
def __init__(self, parent, text, x, y, width, height, callback=None, isFocus=False, color=0xD6EFFE, selectedColor=0xffffff, limit=0, size=16): Window.__init__(self, parent, x, y, width, height, False, color) self._Textbox__text = text self._Textbox__callback = callback self._Textbox__size = size self._Textbox__selectedColor = selectedColor self._Textbox__width = width self._Textbox__height = height self._Textbox__bcolor = self.parent.color self._Textbox__enter = False self._Textbox__editing = False self._Textbox__m = Calc(text, (FONT, self._Textbox__size)) self._Textbox__y = (self.height / 2) + (self._Textbox__m[1] / 2) self._Textbox__w = self._Textbox__m[0] self.parent.childs.append(self) self.field = txtfield.New((self.left, self.top, self.left + self.width, self.top + self.height), cornertype=txtfield.ECorner1, txtlimit=limit) self.field.textstyle(u'', 140, 0x0, style=u'normal') self.field.bgcolor(self._Textbox__selectedColor) self.field.add(self._Textbox__text) self.field.select(0, len(self._Textbox__text)) self.field.focus(0) self.field.visible(0)
else: img=ph.Image.new((320,240)) dl.kjwz1=(152,61,301,84)#控件1位置 dl.kjwz2=(152,101,301,124)#控件2位置 ima=ph.Image.new((150,25))#输入框架 imb=ph.Image.new((150,3))#选择框横着1 imc=ph.Image.new((107,3))#选择框横着2 imd=ph.Image.new((3,25))#选择框竖着1 imd=ph.Image.new((3,23))#选择框竖着2 tietu=ph.Image.open(u"../../python/pysoft/tieba/tie.png")#贴吧LOGO图标 maska=ph.Image.new((72,72),"1") maska.load("..\\..\\python\\pysoft\\tieba\\zhe.png")#遮罩 gon=ph.Image.open(u"../../python/pysoft/tieba/gon.png") gof=ph.Image.open(u"../../python/pysoft/tieba/gof.png") kj1=td.New(dl.kjwz1,cornertype=td.ECorner2,strlimit=1)#新建文本控件1 kj2=td.New(dl.kjwz2,cornertype=td.ECorner2,txtlimit=16)#新建文本控件2 kj1.bgcolor(dl.kjcr)#控件1颜色 kj2.bgcolor(dl.kjcr)#控件2颜色 kj1.textstyle(u"Sans MT 936_s60",15*10,0xf,u'normal')#控件2字体 kj2.textstyle(u"Sans MT 936_s60",15*10,0xf,u'normal')#控件2字体 kj1.visible(0) kj2.visible(0)#可视为假 x,y,s_p=50,69,0 id=cn("请输入帐号") psw=cn("请输入密码") tbui= tbUi()