コード例 #1
0
ファイル: pytorque.py プロジェクト: samucaoo1/tge-152-fork
#example of executing a script file
#f = file("myscript.cs","rb")
#script = f.read()
#f.close()
#pytorque.evaluate(script)

#or, just generate the cs code right inside Python!

pytorque.evaluate("""
new GuiBitmapButtonCtrl(MyButton) {
 profile = "GuiButtonProfile";
 horizSizing = "right";
 vertSizing = "bottom";
 position = "404 361";
 extent = "285 85";
 minExtent = "8 2";
 visible = "1";
 text = "Button";
 groupNum = "-1";
 buttonType = "PushButton";
 bitmap = "./button";
 helpTag = "0";
};""")

#it's easy to grab a reference to the button we created
button = TorqueObject("MyButton")

#buttons are kind of worthless without commands.  Let's make one:
def OnMyButton(value):
    print "Button pushed with value",value
    
コード例 #2
0
 def _startGame(self, port):
     print "port[%d]" % port
     #pytorque.evaluate('JoinServerGui.joinServer("%s", "", "IP:%s:%d");'%(self.name, self.ip, port))Canvas.setContent(PlayerSelection);
     pytorque.evaluate('Canvas.setContent(PlayerSelection);')
コード例 #3
0
 def _startGame(self, port):
     print "port[%d]"%port
     #pytorque.evaluate('JoinServerGui.joinServer("%s", "", "IP:%s:%d");'%(self.name, self.ip, port))Canvas.setContent(PlayerSelection);
     pytorque.evaluate('Canvas.setContent(PlayerSelection);')