@woee: I did exactly the same in an other program and there wxglade does change!
P.S. it's wxpython not pygtk
@sneekula: I made a program with wxglade, I added some functions in the code, but when I ran the script the entry values are not updated like I thought they would...
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# generated by wxGlade 0.6.3 on Sat Nov 7 12:15:47 2009
import wx
# begin wxGlade: extracode
# end wxGlade
class game(wx.Frame):
def __init__(self, *args, **kwds):
# begin wxGlade: game.__init__
kwds["style"] = wx.DEFAULT_FRAME_STYLE
wx.Frame.__init__(self, *args, **kwds)
self.extra10 = wx.StaticText(self, -1, "Name")
self.extra101 = wx.TextCtrl(self, -1, "")
self.extra11 = wx.StaticText(self, -1, "Money")
self.extra111 = wx.TextCtrl(self, -1, "", style=wx.TE_READONLY)
self.extra30 = wx.StaticText(self, -1, "Jackpot")
self.extra301 = wx.TextCtrl(self, -1, "", style=wx.TE_READONLY)
self.extra20 = wx.StaticText(self, -1, "Name")
self.extra201 = wx.TextCtrl(self, -1, "", style=wx.TE_READONLY)
self.extra21 = wx.StaticText(self, -1, "Money")
self.extra211 = wx.TextCtrl(self, -1, "", style=wx.TE_READONLY)
self.info10 = wx.StaticText(self, -1, "Name")
self.info11 = wx.TextCtrl(self, -1, "", style=wx.TE_READONLY)
self.info20 = wx.StaticText(self, -1, "Owned by")
self.info21 = wx.TextCtrl(self, -1, "", style=wx.TE_READONLY)
self.info30 = wx.StaticText(self, -1, "extra")
self.info31 = wx.TextCtrl(self, -1, "", style=wx.TE_READONLY)
self.nextturn = wx.Button(self, -1, "Next Turn")
self.buybutton = wx.Button(self, -1, "Buy")
self.otherbutton = wx.Button(self, -1, "Other")
# Menu Bar
self.menubar2 = wx.MenuBar()
self.SetMenuBar(self.menubar2)
# Menu Bar end
self.status = self.CreateStatusBar(1, 0)
self.__set_properties()
self.__do_layout()
self.Bind(wx.EVT_BUTTON, self.next_turn, self.nextturn)
self.Bind(wx.EVT_BUTTON, self.buy, self.buybutton)
# end wxGlade
global names
global money
def __set_properties(self):
# begin wxGlade: game.__set_properties
self.SetTitle("frame_2")
self.buybutton.Enable(False)
self.otherbutton.Enable(False)
self.status.SetStatusWidths([-1])
# statusbar fields
status_fields = ["frame_2_statusbar"]
for i in range(len(status_fields)):
self.status.SetStatusText(status_fields[i], i)
# end wxGlade
def __do_layout(self):
# begin wxGlade: game.__do_layout
sizer_2 = wx.BoxSizer(wx.VERTICAL)
sizer_3 = wx.BoxSizer(wx.VERTICAL)
sizer_6 = wx.BoxSizer(wx.HORIZONTAL)
sizer_7 = wx.BoxSizer(wx.HORIZONTAL)
sizer_10 = wx.BoxSizer(wx.HORIZONTAL)
sizer_9 = wx.BoxSizer(wx.HORIZONTAL)
sizer_8 = wx.BoxSizer(wx.HORIZONTAL)
grid_sizer_4 = wx.GridSizer(10, 10, 0, 0)
sizer_4 = wx.BoxSizer(wx.HORIZONTAL)
grid_sizer_3 = wx.GridSizer(2, 2, 0, 0)
sizer_5 = wx.BoxSizer(wx.HORIZONTAL)
grid_sizer_2 = wx.GridSizer(2, 2, 0, 0)
grid_sizer_2.Add(self.extra10, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ADJUST_MINSIZE, 0)
grid_sizer_2.Add(self.extra101, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ADJUST_MINSIZE, 0)
grid_sizer_2.Add(self.extra11, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ADJUST_MINSIZE, 0)
grid_sizer_2.Add(self.extra111, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ADJUST_MINSIZE, 0)
sizer_4.Add(grid_sizer_2, 1, wx.EXPAND, 0)
sizer_5.Add(self.extra30, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ADJUST_MINSIZE, 0)
sizer_5.Add(self.extra301, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ADJUST_MINSIZE, 0)
sizer_4.Add(sizer_5, 1, wx.EXPAND, 0)
grid_sizer_3.Add(self.extra20, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ADJUST_MINSIZE, 0)
grid_sizer_3.Add(self.extra201, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ADJUST_MINSIZE, 0)
grid_sizer_3.Add(self.extra21, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ADJUST_MINSIZE, 0)
grid_sizer_3.Add(self.extra211, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ADJUST_MINSIZE, 0)
sizer_4.Add(grid_sizer_3, 1, wx.EXPAND, 0)
sizer_3.Add(sizer_4, 1, wx.EXPAND, 0)
sizer_3.Add(grid_sizer_4, 1, wx.EXPAND, 0)
sizer_8.Add(self.info10, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ADJUST_MINSIZE, 0)
sizer_8.Add(self.info11, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ADJUST_MINSIZE, 0)
sizer_7.Add(sizer_8, 1, wx.EXPAND, 0)
sizer_9.Add(self.info20, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ADJUST_MINSIZE, 0)
sizer_9.Add(self.info21, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ADJUST_MINSIZE, 0)
sizer_7.Add(sizer_9, 1, wx.EXPAND, 0)
sizer_10.Add(self.info30, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ADJUST_MINSIZE, 0)
sizer_10.Add(self.info31, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ADJUST_MINSIZE, 0)
sizer_7.Add(sizer_10, 1, wx.EXPAND, 0)
sizer_3.Add(sizer_7, 1, wx.EXPAND, 0)
sizer_6.Add(self.nextturn, 0, wx.EXPAND|wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ADJUST_MINSIZE, 0)
sizer_6.Add(self.buybutton, 0, wx.EXPAND|wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ADJUST_MINSIZE, 0)
sizer_6.Add(self.otherbutton, 0, wx.EXPAND|wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ADJUST_MINSIZE, 0)
sizer_3.Add(sizer_6, 1, wx.EXPAND|wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL, 0)
sizer_2.Add(sizer_3, 1, wx.EXPAND, 0)
self.SetSizer(sizer_2)
sizer_2.Fit(self)
self.Layout()
# end wxGlade
def initialize(self):
self.turn = 1
self.places = [0,1,1]
self.buildings = [[],["Start","Dragopoly","Not Buyable",""],["2","Dragopoly","2","25",10],["3","Dragopoly","3","25",15],["4","Dragopoly","4","25",20],["5","Dragopoly","5","25",25],["6","Dragopoly","6","25",30],["7","Dragopoly","7","25",31],["8","Dragopoly","8","25",32],["9","Dragopoly","9","25",33],["Prison","Dragopoly","Visit",""],["11","Dragopoly","11","25",35],["12","Dragopoly","12","25",40],["13","Dragopoly","13","25",45],["14","Dragopoly","14","25",50],["15","Dragopoly","15","25",55],["16","Dragopoly","13","25",60],["17","Dragopoly","13","25",65],["18","Dragopoly","13","25",70],["19","Dragopoly","13","25",75],["Parking","Dragopoly","Get jackpot",""],["21","Dragopoly","13","25",80],["22","Dragopoly","13","25",85],["23","Dragopoly","13","25",90],["24","Dragopoly","13","25",95],["25","Dragopoly","13","25",100],["26","Dragopoly","13","25",105],["27","Dragopoly","13","25",110],["28","Dragopoly","13","25",115],["29","Dragopoly","13","25",120],["Goto Hospital","Dragopoly","Goto Hospital",""],["31","Dragopoly","13","25",125],["32","Dragopoly","13","25",130],["33","Dragopoly","13","25",135],["34","Dragopoly","13","25",140],["35","Dragopoly","13","25",145],["36","Dragopoly","13","25",150],["37","Dragopoly","13","25",155],["38","Dragopoly","13","25",160],["39","Dragopoly","13","25",165],["Dragopoly Tax","Dragopoly","Pay 200","25",166]]
self.owns = [[0],[0],[0]]
self.jackpot = 0
self.extra101.WriteText(names[1])
self.extra201.WriteText(names[2])
self.extra111.WriteText(str(money[1]))
self.extra211.WriteText(str(money[2]))
self.turn = 0
def next_turn(self, event): # wxGlade: game.<event_handler>
print "Event handler `next_turn' not implemented!"
event.Skip()
def buy(self, event): # wxGlade: game.<event_handler>
print "Event handler `buy' not implemented!"
event.Skip()
# end of class game
class Main(wx.Frame):
def __init__(self, *args, **kwds):
# begin wxGlade: Main.__init__
kwds["style"] = wx.DEFAULT_FRAME_STYLE
wx.Frame.__init__(self, *args, **kwds)
# Menu Bar
self.menubar = wx.MenuBar()
wxglade_tmp_menu = wx.Menu()
wxglade_tmp_menu.Append(wx.NewId(), "New", "", wx.ITEM_NORMAL)
wxglade_tmp_menu.Append(wx.NewId(), "open", "", wx.ITEM_NORMAL)
self.menubar.Append(wxglade_tmp_menu, "File")
wxglade_tmp_menu = wx.Menu()
self.menubar.Append(wxglade_tmp_menu, "Help")
self.SetMenuBar(self.menubar)
# Menu Bar end
self.p1name = wx.StaticText(self, -1, "Player 1 Name:", style=wx.ALIGN_CENTRE)
self.p1entry = wx.TextCtrl(self, -1, "")
self.p2name = wx.StaticText(self, -1, "Player 2 Name:", style=wx.ALIGN_CENTRE)
self.p2entry = wx.TextCtrl(self, -1, "")
self.moneystart = wx.StaticText(self, -1, "Money:", style=wx.ALIGN_CENTRE)
self.moneyentry = wx.TextCtrl(self, -1, "")
self.newgamebutton = wx.Button(self, -1, "start new game")
self.newgameinfo = wx.StaticText(self, -1, "Money: the ammount of\n money each player gets\n at the start")
self.__set_properties()
self.__do_layout()
self.Bind(wx.EVT_MENU, self.new_game, id=-1)
self.Bind(wx.EVT_BUTTON, self.new_game, self.newgamebutton)
# end wxGlade
def __set_properties(self):
# begin wxGlade: Main.__set_properties
self.SetTitle("frame_1")
# end wxGlade
def __do_layout(self):
# begin wxGlade: Main.__do_layout
sizer_1 = wx.BoxSizer(wx.VERTICAL)
grid_sizer_1 = wx.GridSizer(4, 2, 0, 0)
grid_sizer_1.Add(self.p1name, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ADJUST_MINSIZE, 0)
grid_sizer_1.Add(self.p1entry, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ADJUST_MINSIZE, 0)
grid_sizer_1.Add(self.p2name, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ADJUST_MINSIZE, 0)
grid_sizer_1.Add(self.p2entry, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ADJUST_MINSIZE, 0)
grid_sizer_1.Add(self.moneystart, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ADJUST_MINSIZE, 0)
grid_sizer_1.Add(self.moneyentry, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ADJUST_MINSIZE, 0)
grid_sizer_1.Add(self.newgamebutton, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ADJUST_MINSIZE, 0)
grid_sizer_1.Add(self.newgameinfo, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ADJUST_MINSIZE, 0)
sizer_1.Add(grid_sizer_1, 1, wx.EXPAND, 0)
self.SetSizer(sizer_1)
sizer_1.Fit(self)
self.Layout()
# end wxGlade
def new_game(self, event): # wxGlade: Main.<event_handler>
global names
global money
names = [0,self.p1entry.GetValue(),self.p2entry.GetValue()]
money = [0,int(self.moneyentry.GetValue()),int(self.moneyentry.GetValue())]
game(self).Show()
Main.Hide(self)
game(self).initialize()
# end of class Main
if __name__ == "__main__":
app = wx.PySimpleApp(0)
wx.InitAllImageHandlers()
frame_1 = Main(None, -1, "")
app.SetTopWindow(frame_1)
frame_1.Show()
app.MainLoop()