示例#1
0
 def __init__(self):
     wx.Frame.__init__(self,
                       None,
                       title="Grid demo",
                       pos=wx.DefaultPosition,
                       size=wx.DefaultSize,
                       style=wx.DEFAULT_FRAME_STYLE)
     sizer = wx.BoxSizer()
     self.SetSizer(sizer)
     bmp_rabbit, bmp_carrot = [
         wx.BitmapFromImage(wx.ImageFromStream(StringIO.StringIO(x)))
         for x in (IMG_RABBIT, IMG_CARROT)
     ]
     d = {"rabbit": bmp_rabbit, "carrot": bmp_carrot}
     grid = wx.grid.Grid(self)
     sizer.Add(grid, 1, wx.EXPAND)
     grid.CreateGrid(4, 5)
     grid.SetGridLineColour(wx.BLACK)
     self.grid = grid
     for i in range(4):
         hook_grid_button_column(grid, i, d)
         for j in range(4):
             grid.SetCellValue(
                 i, j, (((i + j) % 2 == 0 and "rabbit:") or "carrot:") +
                 BU_NORMAL)
         grid.SetCellValue(i, 4, "Row %d" % (i + 1))
         grid.SetReadOnly(i, 4)
     grid.SetColLabelSize(0)
     grid.SetRowLabelSize(0)
     self.Bind(EVT_GRID_BUTTON, self.on_grid_button, grid)
     self.Bind(wx.grid.EVT_GRID_CELL_LEFT_CLICK, self.on_left_click,
               grid)
    def grid_setup(self):
        """Perform the initial setup and layout of the grid."""
        # @type grid wx.grid.Grid
        grid = self.panel.gridExp
        #General settings
        #grid.SetSelectionMode(wx.grid.Grid.wxGridSelectRows)
        #Label width/height
        grid.SetColLabelSize(40)
        grid.SetRowLabelSize(40)

        #Find that the grid should be
        num_angles = len(model.instrument.inst.angles)
        num_cols = 4 + num_angles
        if grid.GetNumberCols() > num_cols:
            grid.DeleteCols(0, grid.GetNumberCols() - num_cols)
        if grid.GetNumberCols() < num_cols:
            grid.AppendCols(num_cols - grid.GetNumberCols())

        #The column headers
        grid.SetColLabelValue(0, "Use?")
        grid.SetColSize(0, 50)
        #Column # of the criterion
        self.criterion_col = num_angles + 1
        grid.SetColLabelValue(self.criterion_col, "Stopping\nCriterion")
        grid.SetColSize(self.criterion_col, 180)
        grid.SetColLabelValue(self.criterion_col + 1, "Criterion\nValue")
        grid.SetColSize(self.criterion_col + 1, 100)
        grid.SetColLabelValue(self.criterion_col + 2, "Comment")
        grid.SetColSize(self.criterion_col + 2, 120)
        for (i, anginfo) in enumerate(model.instrument.inst.angles):
            grid.SetColLabelValue(
                i + 1, anginfo.name + "\n(" + anginfo.friendly_units + ")")
            grid.SetColSize(i + 1, 100)
示例#3
0
def setup_grid(grid, title):
    """
    This function only works with type wx.grid.Grid
    The it will create a grid that is like the one found in LinkCtrl/View.
    :param grid:
    :return:
    """

    grid.CreateGrid(6, 2)
    grid.EnableEditing(False)
    grid.EnableGridLines(True)
    grid.SetGridLineColour(wx.Colour(0, 0, 0))
    grid.EnableDragGridSize(False)

    # Columns
    grid.EnableDragColMove(False)
    grid.EnableDragColSize(True)
    grid.SetColLabelSize(0)
    grid.SetColLabelAlignment(wx.ALIGN_CENTER, wx.ALIGN_CENTER)
    grid.SetColSize(0, 110)

    # Rows
    grid.EnableDragRowSize(True)
    grid.SetRowLabelSize(0)
    grid.SetRowLabelAlignment(wx.ALIGN_CENTER, wx.ALIGN_CENTER)

    # Defaults
    grid.SetDefaultCellBackgroundColour(wx.Colour(255, 255, 255))  # white
    grid.SetDefaultCellAlignment(wx.ALIGN_LEFT, wx.ALIGN_TOP)

    # Set Cell Values
    grid.SetCellValue(0, 0, " %s" % title)
    grid.SetCellValue(1, 0, " Variable Name")
    grid.SetCellValue(2, 0, " Geometry Type")
    grid.SetCellValue(3, 0, " Geometry Count")
    grid.SetCellValue(4, 0, " Coordinate System")
    grid.SetCellValue(5, 0, " Spatial Extent")

    # set the default background color
    grid.SetDefaultCellBackgroundColour('WHITE')

    # change color and size of header
    grid.SetCellSize(0, 0, 1, 2)  # span cols 0 and 1
    grid.SetCellBackgroundColour(0, 0, wx.Colour(195, 195, 195))  # Grey

    # set the table column size
    grid.SetColSize(0, 133)
    grid.SetColSize(1, 155)

    # change color of properties
    for i in range(1, grid.GetNumberRows()):
        grid.SetCellBackgroundColour(i, 0, wx.Colour(250, 250,
                                                     250))  # light Grey

    grid.SetGridLineColour(wx.Colour(195, 195, 195))
示例#4
0
    def draw_table(self, i, x, y):
        results = self.type_result[i]
        # size = self.ssize[i]
        size_of_par = self.size_of_par[i]

        grid = self.tables[i]
        grid.SetMaxSize(wx.Size(320, 360))
        grid.SetMinSize(wx.Size(320, 360))
        names = self.names[i]

        grid.CreateGrid(28, 13)
        grid.EnableEditing(True)
        grid.EnableGridLines(True)
        grid.EnableDragGridSize(False)
        grid.SetMargins(0, 0)

        # Columns
        grid.EnableDragColMove(False)
        grid.EnableDragColSize(True)
        grid.SetColLabelSize(30)
        grid.SetColLabelAlignment(wx.ALIGN_CENTRE, wx.ALIGN_CENTRE)
        i = 0
        for namei in names:
            grid.SetColLabelValue(i, namei)
            i += 1

        # 设置内容
        # Rows
        grid.EnableDragRowSize(True)
        grid.SetRowLabelSize(80)
        grid.SetRowLabelAlignment(wx.ALIGN_CENTRE, wx.ALIGN_CENTRE)

        # Label Appearance

        # Cell Defaults
        grid.SetDefaultCellAlignment(wx.ALIGN_LEFT, wx.ALIGN_TOP)
        """"设置内容"""
        j = 0
        for result in results:
            i = 0
            for row in result:
                # 截段输出 numpy 抽样结果过长
                grid.SetCellValue(i, j, str(("%.3f" % row)))
                i = i + 1
            j += 1

        self.gbSizer_show.Add(grid, wx.GBPosition(x, y), wx.GBSpan(1, 3),
                              wx.ALL, 5)
        return y + size_of_par
示例#5
0
    def init_grid(self, grid):
        # Grid
        grid.CreateGrid(7, 2)
        grid.EnableEditing(False)
        grid.EnableGridLines(True)
        grid.SetGridLineColour(wx.Colour(0, 0, 0))
        grid.EnableDragGridSize(False)
        grid.SetMargins(0, 0)

        # Columns
        grid.EnableDragColMove(False)
        grid.EnableDragColSize(True)
        grid.SetColLabelSize(0)
        grid.SetColLabelAlignment(wx.ALIGN_CENTRE, wx.ALIGN_CENTRE)

        # Rows
        grid.EnableDragRowSize(True)
        grid.SetRowLabelSize(0)
        grid.SetRowLabelAlignment(wx.ALIGN_CENTRE, wx.ALIGN_CENTRE)

        # Label Appearance

        # Cell Defaults
        grid.SetDefaultCellBackgroundColour(wx.Colour(255, 255, 255))
        grid.SetDefaultCellAlignment(wx.ALIGN_LEFT, wx.ALIGN_TOP)

        # Set Cell Values
        grid.SetCellValue(0, 0, " Variable")
        grid.SetCellValue(1, 0, " Name")
        grid.SetCellValue(2, 0, " Description")
        grid.SetCellValue(3, 0, " Unit")
        grid.SetCellValue(4, 0, " Name")
        grid.SetCellValue(5, 0, " Type")
        grid.SetCellValue(6, 0, " Abbreviation")

        grid.SetCellBackgroundColour(0, 0, wx.Colour(195, 195, 195))
        grid.SetCellBackgroundColour(0, 1, wx.Colour(195, 195, 195))
        grid.SetCellBackgroundColour(3, 0, wx.Colour(195, 195, 195))
        grid.SetCellBackgroundColour(3, 1, wx.Colour(195, 195, 195))
        grid.SetGridLineColour(wx.Colour(195, 195, 195))
        self.resize_grid_to_fill_white_space(grid)
 def buidUISizer(self):
     flagsR = wx.CENTER
     hsizer = wx.BoxSizer(wx.HORIZONTAL)
     for _ in range(3):
         vSizer = wx.BoxSizer(wx.VERTICAL)
         # Row idx = 0 : show the PLC name/type and the I/O usage.
         nameLb = wx.StaticText(self, label="PLC Name: ".ljust(15))
         self.nameLbList.append(nameLb)
         vSizer.Add(nameLb, flag=flagsR, border=2)
         vSizer.AddSpacer(10)
         gpioLbN = wx.StaticText(self, label="PLC I/O usage: ".ljust(15))
         vSizer.Add(gpioLbN, flag=flagsR, border=2)
         self.gpioLbList.append(gpioLbN)
         vSizer.AddSpacer(10)
         vSizer.Add(wx.StaticLine(self,
                                  wx.ID_ANY,
                                  size=(180, -1),
                                  style=wx.LI_HORIZONTAL),
                    flag=flagsR,
                    border=2)
         vSizer.AddSpacer(10)
         # Row idx =1 : show the PLC data.
         grid = wx.grid.Grid(self, -1)
         grid.CreateGrid(8, 4)
         grid.SetRowLabelSize(30)
         grid.SetColLabelSize(22)
         grid.SetColSize(0, 40)
         grid.SetColSize(1, 40)
         grid.SetColSize(2, 40)
         grid.SetColSize(3, 40)
         # Set the column label.
         grid.SetColLabelValue(0, 'IN')
         grid.SetColLabelValue(1, 'Val')
         grid.SetColLabelValue(2, 'OUT')
         grid.SetColLabelValue(3, 'Val')
         vSizer.Add(grid, flag=flagsR, border=2)
         self.gridList.append(grid)
         hsizer.Add(vSizer, flag=flagsR, border=2)
         hsizer.AddSpacer(5)
     return hsizer
示例#7
0
    def __init__(self, window):
        # This is how Python handles classes. __init__ is the special name for
        # the constructor of the class. The first parameter to every object
        # method is the object itself, called "self" by convention. self is
        # like "this" in Java/C++, except you have to explicitly mention it
        # whenever you want to use instance variables or methods.
        grid = wx.grid.Grid(parent=window)
        grid.CreateGrid(sudoku.ROW_SIZE, sudoku.ROW_SIZE)

        # Set row and column sizes, and fix them so the user can't change them
        grid.SetRowLabelSize(0)
        grid.SetColLabelSize(0)
        grid.SetDefaultRowSize(40, True)
        grid.SetDefaultColSize(40, True)
        grid.DisableDragGridSize()

        # Change cell attributes to work well for Sudoku displaying
        font = grid.GetDefaultCellFont()
        font.SetPointSize(20)
        grid.SetDefaultCellFont(font)
        grid.SetDefaultCellAlignment(wx.ALIGN_CENTER, wx.ALIGN_CENTER)

        self.grid = grid
示例#8
0
    def __init__(self, parent, square, size):
        self.size = size
        grid = wx.grid.Grid(parent, -1)
        grid.CreateGrid(self.size + 2, self.size + 2)

        # Set Sizer
        '''Sizer = wx.BoxSizer(wx.HORIZONTAL)
        Sizer.Add(grid, 0, wx.ALIGN_CENTER|wx.ALL, 5)
        parent.SetSizerAndFit(Sizer)'''

        # Set Labels not visible
        grid.SetRowLabelSize(0)
        grid.SetColLabelSize(0)
        
        # Set Row and Column size
        grid.SetDefaultRowSize(40)
        grid.SetDefaultColSize(40)

        # Print Square Values as string
        for j in range(2, self.size + 2):
            for i in range(2, self.size + 2):
                grid.SetCellAlignment(i-1, j-1, wx.ALIGN_CENTER, wx.ALIGN_CENTER)
                grid.SetCellValue(i-1, j-1, str(square[(i-1,j-1)]))
                grid.SetReadOnly(i-1, j-1)
        
        # Evaluate Rows Sum
        for i in range(1, self.size + 1):
            mg_num = self.evaluateRowSum(square, i)
            grid.SetCellAlignment(i, self.size+1, wx.ALIGN_CENTER, wx.ALIGN_CENTER)
            grid.SetCellBackgroundColour(i, self.size+1, wx.YELLOW)
            grid.SetCellValue(i, self.size+1, str(mg_num))
            grid.SetCellAlignment(i, 0, wx.ALIGN_CENTER, wx.ALIGN_CENTER)
            grid.SetCellBackgroundColour(i, 0, wx.YELLOW)
            grid.SetCellValue(i, 0, str(mg_num))
            grid.SetReadOnly(i, 0)
            
        # Evaluate Columns Sum  
        for j in range(1, self.size + 1):
            mg_num = self.evaluateColSum(square, j)
            grid.SetCellAlignment(self.size+1, j, wx.ALIGN_CENTER, wx.ALIGN_CENTER)
            grid.SetCellBackgroundColour(self.size+1, j, wx.GREEN)
            grid.SetCellValue(self.size+1, j, str(mg_num))
            grid.SetCellAlignment(0, j, wx.ALIGN_CENTER, wx.ALIGN_CENTER) 
            grid.SetCellBackgroundColour(0, j, wx.GREEN)
            grid.SetCellValue(0, j, str(mg_num)) 
            grid.SetReadOnly(0, j)
        
        #Evaluate Diagonal 1
        diag1 = self.evaluateDiag1(square)
        grid.SetCellAlignment(self.size+1, self.size+1, wx.ALIGN_CENTER, wx.ALIGN_CENTER)
        grid.SetCellBackgroundColour(self.size+1, self.size+1, wx.BLUE)
        grid.SetCellTextColour(self.size+1, self.size+1, wx.WHITE)
        grid.SetCellValue(self.size+1, self.size+1, str(diag1))
        grid.SetReadOnly(self.size+1, self.size+1)
        grid.SetCellAlignment(0, 0, wx.ALIGN_CENTER, wx.ALIGN_CENTER)
        grid.SetCellBackgroundColour(0, 0, wx.BLUE)
        grid.SetCellTextColour(0, 0, wx.WHITE)
        grid.SetCellValue(0, 0, str(diag1))
        grid.SetReadOnly(0, 0)
        
        #Evaluate Diagonal 2
        diag2 = self.evaluateDiag2(square)
        grid.SetCellAlignment(0, self.size+1, wx.ALIGN_CENTER, wx.ALIGN_CENTER)
        grid.SetCellBackgroundColour(0, self.size+1, wx.RED)
        grid.SetCellTextColour(0, self.size+1, wx.WHITE)
        grid.SetCellValue(0, self.size+1, str(diag2))
        grid.SetReadOnly(0, self.size+1)
        grid.SetCellAlignment(self.size+1, 0, wx.ALIGN_CENTER, wx.ALIGN_CENTER) 
        grid.SetCellBackgroundColour(self.size+1, 0, wx.RED)
        grid.SetCellTextColour(self.size+1, 0, wx.WHITE)
        grid.SetCellValue(self.size+1, 0, str(diag2))   
        grid.SetReadOnly(self.size+1, 0)     

        parent.Show()
示例#9
0
文件: omaha.py 项目: frankdeath/ooc
    def __init__(self, parent):
        wx.Panel.__init__(self, parent, -1)

        self.hand_type = {0:'No Pair', 1:'One Pair', 2:'Two Pair', 3:'Three of a Kind', 4:'Straight', 5:'Flush', 6:'Full House', 7:'Four of a Kind', 8:'Straight Flush', 9:'Five of a Kind'}

        # Initialize the hand so that it's easier to implement active min hand calc
        #self.card_array = [12,11,51,50,10,9,8,7]
        self.card_array = [53] * 9

        self.right_clicked_card = -1
        self.right_click_selection = -1
        self.last_flop_array = [53] * 9
        self.last_turn_array = [53] * 9
        self.last_showdown_array = [53] * 9
        self.flop_turn_results = ()
        self.flop_river_results = ()
        self.flop_better_hands = []
        self.turn_river_results = ()
        self.turn_better_hands = []
        self.showdown_results = ()
        self.showdown_better_hands = []

        self.better = ()

        self.minipanel_is_open = 0
        self.minipanel = -1

        grid = wx.grid.Grid(self, -1, size = wx.Size(500, 347), style = wx.SIMPLE_BORDER)
        grid.CreateGrid(9, 5)
        grid.SetColLabelValue(0, "Hand")
        grid.SetColLabelValue(1, "Count")
        grid.SetColLabelValue(2, "Odds 1:x")
        grid.SetColLabelValue(3, "Probability")
        grid.SetColLabelValue(4, "# Better")
        grid.SetColSize(0, 160)
        grid.SetColSize(1, COL_SIZE)
        grid.SetColSize(2, COL_SIZE)
        grid.SetColSize(3, COL_SIZE)
        grid.SetColSize(4, COL_SIZE)
        grid.SetRowSize(0, ROW_SIZE)
        grid.SetRowSize(1, ROW_SIZE)
        grid.SetRowSize(2, ROW_SIZE)
        grid.SetRowSize(3, ROW_SIZE)
        grid.SetRowSize(4, ROW_SIZE)
        grid.SetRowSize(5, ROW_SIZE)
        grid.SetRowSize(6, ROW_SIZE)
        grid.SetRowSize(7, ROW_SIZE)
        grid.SetRowSize(8, ROW_SIZE)
        grid.SetColLabelSize(30)
        grid.SetRowLabelSize(0)
        grid.EnableEditing(False)
        grid.EnableDragColSize(False)
        grid.EnableDragRowSize(False)
        grid.EnableDragGridSize(False)
        grid.SetDefaultCellAlignment(wx.ALIGN_CENTRE, wx.ALIGN_CENTRE)
        font = wx.Font(12, family = wx.ROMAN, style = wx.NORMAL, weight = wx.BOLD)
        grid.SetDefaultCellFont(font)
        # This is the magical line that turns off the scrollbars
        # Thank you: http://lists.wxwidgets.org/archive/wxPython-users/msg10178.html
        grid.SetMargins(-100,-100)

        self.grid = grid

        font = wx.Font(14, family = wx.MODERN, style = wx.NORMAL, weight = wx.BOLD)

        #self.title = wx.StaticText(self, -1, "", size=(250,25), style = wx.ST_NO_AUTORESIZE | wx.ALIGN_CENTRE | wx.SIMPLE_BORDER, name = "Title")
        self.title = wx.StaticText(self, -1, "", size=(250,25), style = wx.ST_NO_AUTORESIZE | wx.ALIGN_CENTRE, name = "Title")
        # font styles:
        # family = wx.DEFAULT, wx.DECORATIVE, wx.ROMAN, wx.SCRIPT, wx.SWISS, wx.MODERN
        # style = wx.NORMAL, wx.SLANT, wx.ITALIC
        # weight = wx.NORMAL, wx.LIGHT, wx.BOLD
        self.title.SetFont(font)

        title_sizer = wx.BoxSizer ( wx.HORIZONTAL )
        
        title_sizer.Add((30,30), 0, wx.ALIGN_CENTRE_VERTICAL)
        title_sizer.Add(self.title, 0, wx.ALIGN_CENTRE_VERTICAL)
        title_sizer.Add((30,30), 0, wx.ALIGN_CENTRE_VERTICAL)

        font = wx.Font(13, family = wx.MODERN, style = wx.NORMAL, weight = wx.BOLD)

        # call min_hand_eval here
        #current_h = self.MinHandEval()
        current_h = ""

        #self.hand_display = wx.StaticText(self, -1, current_h, size=(200,25), style = wx.ST_NO_AUTORESIZE | wx.ALIGN_CENTRE | wx.SIMPLE_BORDER)
        self.hand_display = wx.StaticText(self, -1, current_h, size=(200,25), style = wx.ST_NO_AUTORESIZE | wx.ALIGN_CENTRE)
        self.hand_display.SetFont(font)

        # hutchison index
        #h_index = hutchison(self.card_array[:4])
        h_index = ""
        #self.hutch_display = wx.StaticText(self, -1, h_index, size=(200,25), style = wx.ST_NO_AUTORESIZE | wx.ALIGN_CENTRE | wx.SIMPLE_BORDER)
        self.hutch_display = wx.StaticText(self, -1, h_index, size=(200,25), style = wx.ST_NO_AUTORESIZE | wx.ALIGN_CENTRE)
        self.hutch_display.SetFont(font)

        hand_disp_sizer = wx.BoxSizer( wx.HORIZONTAL )

        hand_disp_sizer.Add(self.hutch_display, 0 , wx.ALIGN_CENTER_VERTICAL)
        hand_disp_sizer.Add((30,50), 0, wx.ALIGN_CENTRE_VERTICAL)
        hand_disp_sizer.Add(self.hand_display, 0, wx.ALIGN_CENTRE_VERTICAL)
        #hand_disp_sizer.Add((30,50), 0, wx.ALIGN_CENTRE_VERTICAL)

        self.button1 = wx.Button(self, ID_BUTTON1, "Turn", size=(70,30))
        self.button2 = wx.Button(self, ID_BUTTON2, "River", size=(70,30))
        self.button3 = wx.Button(self, ID_BUTTON3, "River+", size=(70,30))
        self.button6 = wx.Button(self, ID_BUTTON6, "Showdown", size=(70,30))
        self.button4 = wx.Button(self, ID_BUTTON4, "Reset", size=(70,30))
        self.button5 = wx.Button(self, ID_BUTTON5, "Panel", size=(70,30))

        self.button1.Disable()
        self.button2.Disable()
        self.button3.Disable()
        self.button4.Disable()
        self.button6.Disable()

        button_sizer = wx.BoxSizer( wx.HORIZONTAL )

        LARGE_BUTTON_SPACE = (20, 40)
        MEDIUM_BUTTON_SPACE = (12, 40)
        SMALL_BUTTON_SPACE = (2, 40)

        button_sizer.Add(self.button5, 0, wx.ALIGN_CENTRE_VERTICAL)
        button_sizer.Add(LARGE_BUTTON_SPACE, 0, wx.ALIGN_CENTRE_VERTICAL)
        button_sizer.Add(self.button1, 0, wx.ALIGN_CENTRE_VERTICAL)
        button_sizer.Add(SMALL_BUTTON_SPACE, 0, wx.ALIGN_CENTRE_VERTICAL)
        button_sizer.Add(self.button2, 0, wx.ALIGN_CENTRE_VERTICAL)
        button_sizer.Add(MEDIUM_BUTTON_SPACE, 0, wx.ALIGN_CENTRE_VERTICAL)
        button_sizer.Add(self.button3, 0, wx.ALIGN_CENTRE_VERTICAL)
        button_sizer.Add(MEDIUM_BUTTON_SPACE, 0, wx.ALIGN_CENTRE_VERTICAL)
        button_sizer.Add(self.button6, 0, wx.ALIGN_CENTRE_VERTICAL)
        button_sizer.Add(LARGE_BUTTON_SPACE, 0, wx.ALIGN_CENTRE_VERTICAL)
        button_sizer.Add(self.button4, 0, wx.ALIGN_CENTRE_VERTICAL)

        # Initialize the cards
        self.card1 = wx.StaticBitmap(self, ID_CARD_1, catalog[index[self.card_array[0]]].getBitmap(), name = "Card1")
        self.card2 = wx.StaticBitmap(self, ID_CARD_2, catalog[index[self.card_array[1]]].getBitmap(), name = "Card2")
        self.card3 = wx.StaticBitmap(self, ID_CARD_3, catalog[index[self.card_array[2]]].getBitmap(), name = "Card3")
        self.card4 = wx.StaticBitmap(self, ID_CARD_4, catalog[index[self.card_array[3]]].getBitmap(), name = "Card4")
        self.card5 = wx.StaticBitmap(self, ID_CARD_5, catalog[index[self.card_array[4]]].getBitmap(), name = "Card5")
        self.card6 = wx.StaticBitmap(self, ID_CARD_6, catalog[index[self.card_array[5]]].getBitmap(), name = "Card6")
        self.card7 = wx.StaticBitmap(self, ID_CARD_7, catalog[index[self.card_array[6]]].getBitmap(), name = "Card7")
        self.card8 = wx.StaticBitmap(self, ID_CARD_8, catalog[index[self.card_array[7]]].getBitmap(), name = "Card8")
        self.card9 = wx.StaticBitmap(self, ID_CARD_9, catalog[index[self.card_array[8]]].getBitmap(), name = "Card9")

        self.cards = (self.card1, self.card2, self.card3, self.card4, self.card5, self.card6, self.card7, self.card8, self.card9)

        card_sizer1 = wx.BoxSizer( wx.HORIZONTAL )
        card_sizer2 = wx.BoxSizer( wx.HORIZONTAL )

        LITTLE_SPACER = (5,5)
        BIG_SPACER = (25,5)
        HOLE_SPACER = (5,125)

        card_sizer2.Add(self.card1, 0, wx.ALIGN_CENTRE_VERTICAL)
        card_sizer2.Add(HOLE_SPACER, 0, wx.ALIGN_CENTRE_VERTICAL)
        card_sizer2.Add(self.card2, 0, wx.ALIGN_CENTRE_VERTICAL)
        card_sizer2.Add(HOLE_SPACER, 0, wx.ALIGN_CENTRE_VERTICAL)
        card_sizer2.Add(self.card3, 0, wx.ALIGN_CENTRE_VERTICAL)
        card_sizer2.Add(HOLE_SPACER, 0, wx.ALIGN_CENTRE_VERTICAL)
        card_sizer2.Add(self.card4, 0, wx.ALIGN_CENTRE_VERTICAL)

        card_sizer1.Add(self.card5, 0, wx.ALIGN_CENTRE_VERTICAL)
        card_sizer1.Add(LITTLE_SPACER, 0, wx.ALIGN_CENTRE_VERTICAL)
        card_sizer1.Add(self.card6, 0, wx.ALIGN_CENTRE_VERTICAL)
        card_sizer1.Add(LITTLE_SPACER, 0, wx.ALIGN_CENTRE_VERTICAL)
        card_sizer1.Add(self.card7, 0, wx.ALIGN_CENTRE_VERTICAL)
        card_sizer1.Add(BIG_SPACER, 0, wx.ALIGN_CENTRE_VERTICAL)
        card_sizer1.Add(self.card8, 0, wx.ALIGN_CENTRE_VERTICAL)
        card_sizer1.Add(BIG_SPACER, 0, wx.ALIGN_CENTRE_VERTICAL)
        card_sizer1.Add(self.card9, 0, wx.ALIGN_CENTRE_VERTICAL)

        self.sizer = wx.BoxSizer( wx.VERTICAL )

        self.sizer.Add(title_sizer, 0, wx.ALIGN_CENTRE_HORIZONTAL)
        self.sizer.Add(grid, 0, wx.ALIGN_CENTRE_HORIZONTAL)
        self.sizer.Add(hand_disp_sizer, 0, wx.ALIGN_CENTRE_HORIZONTAL)
        self.sizer.Add(card_sizer1, 0, wx.ALIGN_CENTRE_HORIZONTAL)
        self.sizer.Add(card_sizer2, 0, wx.ALIGN_CENTRE_HORIZONTAL)

        self.sizer.Add(button_sizer, 0, wx.ALIGN_CENTRE_HORIZONTAL)
        
        self.SetSizer(self.sizer)
        self.SetAutoLayout(1)

        self.Bind(wx.grid.EVT_GRID_CELL_RIGHT_CLICK, self.OnCellRightClick, self.grid)
        self.Bind(wx.EVT_BUTTON, self.OnButton5, self.button5)
        self.Bind(wx.EVT_BUTTON, self.OnButton1, self.button1)
        self.Bind(wx.EVT_BUTTON, self.OnButton2, self.button2)
        self.Bind(wx.EVT_BUTTON, self.OnButton3, self.button3)
        self.Bind(wx.EVT_BUTTON, self.OnButton6, self.button6)
        self.Bind(wx.EVT_BUTTON, self.OnButton4, self.button4)
        self.card1.Bind(wx.EVT_LEFT_UP, self.LeftClick)
        self.card2.Bind(wx.EVT_LEFT_UP, self.LeftClick)
        self.card3.Bind(wx.EVT_LEFT_UP, self.LeftClick)
        self.card4.Bind(wx.EVT_LEFT_UP, self.LeftClick)
        self.card5.Bind(wx.EVT_LEFT_UP, self.LeftClick)
        self.card6.Bind(wx.EVT_LEFT_UP, self.LeftClick)
        self.card7.Bind(wx.EVT_LEFT_UP, self.LeftClick)
        self.card8.Bind(wx.EVT_LEFT_UP, self.LeftClick)
        self.card9.Bind(wx.EVT_LEFT_UP, self.LeftClick)
        self.card1.Bind(wx.EVT_RIGHT_UP, self.RightClick)
        self.card2.Bind(wx.EVT_RIGHT_UP, self.RightClick)
        self.card3.Bind(wx.EVT_RIGHT_UP, self.RightClick)
        self.card4.Bind(wx.EVT_RIGHT_UP, self.RightClick)
        self.card5.Bind(wx.EVT_RIGHT_UP, self.RightClick)
        self.card6.Bind(wx.EVT_RIGHT_UP, self.RightClick)
        self.card7.Bind(wx.EVT_RIGHT_UP, self.RightClick)
        self.card8.Bind(wx.EVT_RIGHT_UP, self.RightClick)
        self.card9.Bind(wx.EVT_RIGHT_UP, self.RightClick)
        self.Bind(wx.EVT_MENU, self.OnMenuSelection, id=ID_MENU_2)
        self.Bind(wx.EVT_MENU, self.OnMenuSelection, id=ID_MENU_3)
        self.Bind(wx.EVT_MENU, self.OnMenuSelection, id=ID_MENU_4)
        self.Bind(wx.EVT_MENU, self.OnMenuSelection, id=ID_MENU_5)
        self.Bind(wx.EVT_MENU, self.OnMenuSelection, id=ID_MENU_6)
        self.Bind(wx.EVT_MENU, self.OnMenuSelection, id=ID_MENU_7)
        self.Bind(wx.EVT_MENU, self.OnMenuSelection, id=ID_MENU_8)
        self.Bind(wx.EVT_MENU, self.OnMenuSelection, id=ID_MENU_9)
        self.Bind(wx.EVT_MENU, self.OnMenuSelection, id=ID_MENU_T)
        self.Bind(wx.EVT_MENU, self.OnMenuSelection, id=ID_MENU_J)
        self.Bind(wx.EVT_MENU, self.OnMenuSelection, id=ID_MENU_Q)
        self.Bind(wx.EVT_MENU, self.OnMenuSelection, id=ID_MENU_K)
        self.Bind(wx.EVT_MENU, self.OnMenuSelection, id=ID_MENU_A)
        self.Bind(wx.EVT_MENU, self.OnMenuSelection, id=ID_MENU_S)
        self.Bind(wx.EVT_MENU, self.OnMenuSelection, id=ID_MENU_H)
        self.Bind(wx.EVT_MENU, self.OnMenuSelection, id=ID_MENU_D)
        self.Bind(wx.EVT_MENU, self.OnMenuSelection, id=ID_MENU_C)