当前位置: 首页>>代码示例>>Python>>正文


Python Window.resizeToContent方法代码示例

本文整理汇总了Python中window.Window.resizeToContent方法的典型用法代码示例。如果您正苦于以下问题:Python Window.resizeToContent方法的具体用法?Python Window.resizeToContent怎么用?Python Window.resizeToContent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在window.Window的用法示例。


在下文中一共展示了Window.resizeToContent方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: main

# 需要导入模块: from window import Window [as 别名]
# 或者: from window.Window import resizeToContent [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()
#.........这里部分代码省略.........
开发者ID:rolph-recto,项目名称:Parametric-Tanks,代码行数:103,代码来源:Testmain.py


注:本文中的window.Window.resizeToContent方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。