本文整理汇总了Python中window.Window.add方法的典型用法代码示例。如果您正苦于以下问题:Python Window.add方法的具体用法?Python Window.add怎么用?Python Window.add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类window.Window
的用法示例。
在下文中一共展示了Window.add方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: update_NET_CLIENT_LIST
# 需要导入模块: from window import Window [as 别名]
# 或者: from window.Window import add [as 别名]
def update_NET_CLIENT_LIST():
global properties
old = properties["_NET_CLIENT_LIST"]
new = set(ptxcb.XROOT.get_window_ids())
properties["_NET_CLIENT_LIST"] = new
if old != new:
for wid in new.difference(old):
Window.add(wid)
for wid in old.difference(new):
Window.remove(wid)
# This might be redundant, but it's important to know
# the new active window if the old one was destroyed
# as soon as possible
update_NET_ACTIVE_WINDOW()
示例2: start_sequence
# 需要导入模块: from window import Window [as 别名]
# 或者: from window.Window import add [as 别名]
def start_sequence(window, start_window=True):
print "Hello there, what is your name?"
window.player.name = raw_input("> ")
print "Hello %s. What is your class?" % window.player.name
window.player.pclass = PClass(raw_input("> "))
print "Cool. A %s. Choose your weapon!" % window.player.pclass.class_type
window.player.weapons.append(Weapon(raw_input("> ")))
if start_window:
window.start()
print "You retired from your adventure at level %i." % window.player.level
if __name__ == "__main__":
window = Window()
gamearea = GameArea("gamearea")
window.add(gamearea)
window.player = Player()
healthbar = HealthBar("healthbar")
window.add(healthbar)
window.exit_keys.append(4) # ^D to exit
# ask for player info:
start_sequence(window)
示例3: chr
# 需要导入模块: from window import Window [as 别名]
# 或者: from window.Window import add [as 别名]
try: self.buffer += chr(character) # Append input to buffer
except: pass
# Perform a search for what's in the current buffer.
articles = self.window.get("articles")
url = "articles/search/"+self.buffer+"?per_page=" + str(articles.height)
(res, status) = self.window.c.get(url)
if status == 200:
articles.fill_menu(res)
window = Window(blocking=True)
feedgroups = FeedGroups("feedgroups")
feedgroups.active = False
feedgroups.hidden = True
feeds = Feeds("feeds")
feeds.active = False
feeds.hidden = True
articles = Articles("articles")
reader = Reader("reader")
reader.wrap = True
reader.active = False
articles.reader = reader
status = StatusLine("status")
panes = [feedgroups, feeds, articles, reader]
window.add(panes)
window.add(status)
window.exit_keys.append(4) # ^D to exit
示例4: main
# 需要导入模块: from window import Window [as 别名]
# 或者: from window.Window import add [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()
#.........这里部分代码省略.........
示例5: choose_class
# 需要导入模块: from window import Window [as 别名]
# 或者: from window.Window import add [as 别名]
selection = choose_class()
print(selection)
window.player.pclass = PClass(classes[selection])
# print "Cool. A %s. Choose your weapon!" % window.player.pclass.class_type
# window.player.weapons.append(Weapon(raw_input("> ")))
if start_window:
window.start()
print("You retired from your adventure at level %i." % window.player.level)
if __name__ == "__main__":
window = Window()
gamearea = GameArea("gamearea")
window.add(gamearea)
window.player = Player()
manabar = ManaBar("manabar")
# manabar.hidden = True
healthbar = HealthBar("healthbar")
# healthbar.hidden = True
window.add([healthbar, manabar])
input_pane = Input("input")
input_pane.active = True
menu = TestMenu("menu")
window.add([menu, input_pane])
menu.active = False