本文整理汇总了Python中gui.Gui.optimizeDraw方法的典型用法代码示例。如果您正苦于以下问题:Python Gui.optimizeDraw方法的具体用法?Python Gui.optimizeDraw怎么用?Python Gui.optimizeDraw使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gui.Gui
的用法示例。
在下文中一共展示了Gui.optimizeDraw方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main
# 需要导入模块: from gui import Gui [as 别名]
# 或者: from gui.Gui import optimizeDraw [as 别名]
def main():
pygame.init()
screen = pygame.display.set_mode((640, 480),pygame.SWSURFACE)
pygame.key.set_repeat(100, 100)
'''TEST'''
g=Gui()
#g.enableDirtyRect()
g.optimizeDraw()
i=PygameInput()
Image.mImageLoader=PygameImageLoader()
gr=PygameGraphics()
gr.setTarget(screen)
f=ImageFont("C:\Python25\Projects\Guichan\consolefont.bmp")
#f=ImageFont("consolefont.bmp")
f.setColorkey( Color(255,0,255) )
f.setGlyphSpacing(2)
f2=PygameFont("C:\Python25\Projects\Guichan\LiberationMono-Regular.ttf",14,Color(0,0,0,255))
#f2=PygameFont("C:\Python25\Projects\Guichan\Caracteres L1.ttf",13,Color(0,0,0,255))
f2.setGlyphSpacing(1)
Widget.setGlobalFont(f2)
c=Container()
c.setOpaque(False)
c.setPosition(0,0)
c.setSize(640,480)
c.setBaseColor( Color(255,0,0,255) )
a=ActionListener()
a.action=action
b, b2=Button("YEY!"), Button("WHa?")
b.setPosition(0,50)
b.setActionEventId("Button 1")
b.addActionListener(a)
b2.setPosition(100,100)
b2.setActionEventId("Button 2")
b2.addActionListener(a)
b2.setBaseColor( Color(200,200,200) )
b2.setCaption("[email protected]#$%^&*()")
w,w2=Window("Hey over here!"), Window("Trapped in a window!")
wColor=w.getBaseColor()
wColor.a=200
w.setBaseColor(wColor)
w.setTextColor(Color(255,0,255))
xyz=Button("XYZ")
xyz.setTextColor(Color(0,255,255))
pb=ProgressBar(100.0)
pb.setBaseColor( Color(255,255,0) )
pb.setForegroundColor( Color(0,255,255) )
pb.setSize(100, 20)
pb.setPosition(300, 300)
pb.setValue(50.0)
c.add(w,0,100)
c.add(b)
c.add(b2)
c.add(xyz,10,10)
c.add(pb)
check=Checkbox("Ye what? GET BACK HERE BOY!")
check.setActionEventId("Checkbox")
check.addActionListener(a)
text=TextField("Hey Hey Hey Hey Hey Hey Hey Hey")
text.setBackgroundColor( Color(255,255,255,255) )
text.setMaxSize(150)
text2=TextBox("Hey, HeyTrapped in a window!\nWhat's goin' onTrapped in a window!\ntodays???Trapped in a window!")
text2.setTabSize(10)
sc=ScrollArea(text2)
sc.setSize(200,100)
rBox=Container()
r1=RadioButton("1984","Dystopia")
r2=RadioButton("Fahrenheit 451","Dystopia")
r3=RadioButton("Brave New World","Dystopia")
rBox.add(r1,0,0)
rBox.add(r2,0,r1.getY()+r1.getHeight())
rBox.add(r3,0,r2.getY()+r2.getHeight())
label=Label("WE AIN'T GOT IT")
ico_image=Image.load("C:\Python25\Projects\Guichan\May.bmp")
ico=Icon(ico_image)
lb=ListBox( List_ListModel(["Bollocks!","Never!","Cuppa tea, mate?","Hello!","Goodbye!","OK Computer!","Oh Inverted World!","How To Disappear Completely!","Hold Still!","It Takes A Train To Cry!","A","B","C","D","E","F","G","H","I",]) )
sc2=ScrollArea(lb)
sc2.setSize(125,100)
lb.setWidth(110)
slider=Slider(0,100)
slider.setOrientation(Slider.Orientation.VERTICAL)
slider.setSize(15,100)
slider.setActionEventId("Slider")
#slider.addActionListener(a)
ib=ImageButton(ico_image)
ta=TabbedArea()
c.add(w2)
ta.addTab("Text",[ (text,0,0), (sc,0,50) ])
ta.addTab("Check",check)
ta.addTab("Radio",rBox)
ta.addTab("List",[ (sc2,0,0) ])
ta.addTab("Label",label)
ta.addTab("Icon",[ (ico,0,0), (ib,100,0) ])
ta.addTab("Slider",slider)
ta.setSize(300,300)
w2.add(ta,0,0)
g.setGraphics(gr)
w2.resizeToContent()
#.........这里部分代码省略.........