- #1
Tiiba
- 54
- 0
I've been trying for days to create a window that contains two grids, or a grid and another - any - window. I tried placing them on my own. I tried sizers. No use. It always goes gray.
I asked for help on the usenet. No use. Now I come here.
I asked for help on the usenet. No use. Now I come here.
Code:
from wxPython.wx import *
from wxPython.grid import *
from time import *
GameFrameID = wxNewId()
GridID = wxNewId()
ControlID = wxNewId()
class GameFrame(wxFrame):
def __init__(self, parent, title):
wxFrame.__init__(self, parent, GameFrameID, title, size = (500, 500))
board = wxGrid(parent = self, id = GridID)
board.CreateGrid(numCols = 25, numRows = 25)
board.DisableCellEditControl()
board.DisableDragGridSize()
board.SetColLabelSize(0)
board.SetRowLabelSize(0)
board.SetDefaultColSize(15, 1)
board.SetDefaultRowSize(15, 1)
boardbottom = board.GetDefaultRowSize() * board.GetNumberRows()
boardright = board.GetDefaultColSize() * board.GetNumberCols()
control = wxGrid(parent = self, id = ControlID)
control.CreateGrid(numCols = 5, numRows = 1)
control.DisableCellEditControl()
control.DisableDragGridSize()
control.SetColLabelSize(0)
control.SetRowLabelSize(0)
self.board = board
self.boardbottom = boardbottom
self.boardright = boardright
self.control = control
self.sizer = wxBoxSizer(wxVERTICAL)
self.sizer.Add(self.board)
self.sizer.Add(self.control)
self.SetSizer(self.sizer)
self.SetAutoLayout(true)
self.sizer.Fit(self)
self.Show()
app = wxPySimpleApp()
frame = GameFrame(None, "wxClick")
app.MainLoop()