class_docstr: A controller for the BinaryMatrix setting
      
class_docstr_tok: ["A","controller","for","the","BinaryMatrix","setting"]
docstr: Initialize the controller
  
  module_view - the module_view that contains the controller's panel
  
  v - the setting
docstr_tok: ["Initialize","the","controller","module_view","-","the","module_view","that","contains","the","controller","'s","panel","v","-","the","setting"]
code: def __init__(self, module_view, v):
      """Initialize the controller
  
      module_view - the module_view that contains the controller's panel
  
      v - the setting
      """
      self.module_view = module_view
      self.setting = v
      self.panel = wx.Panel(
          module_view.module_panel, name=edit_control_name(v)
      )
      self.panel.controller = self
      self.panel.Sizer = wx.BoxSizer(wx.VERTICAL)
      self.matrix_ctrl = wx.Panel(self.panel)
      self.panel.Sizer.Add(self.matrix_ctrl, 0, wx.EXPAND | wx.ALL, 10)
      self.matrix_ctrl.SetMinSize(wx.Size(50, 50))
      sizer = wx.BoxSizer(wx.HORIZONTAL)
      self.panel.Sizer.Add(sizer, 0, wx.EXPAND | wx.ALL, 2)
      sizer.Add(
          wx.StaticText(self.panel, label="Width:"),
          0,
          wx.ALIGN_RIGHT | wx.ALIGN_CENTER,
      )
      sizer.AddSpacer(1)
      self.width_ctrl = wx.SpinCtrl(self.panel)
      self.width_ctrl.SetRange(1, 100)
      sizer.Add(self.width_ctrl, 1, wx.EXPAND)
      sizer.AddSpacer(4)
      sizer.Add(
          wx.StaticText(self.panel, label="Height:"),
          0,
          wx.ALIGN_RIGHT | wx.ALIGN_CENTER,
      )
      sizer.AddSpacer(1)
      self.height_ctrl = wx.SpinCtrl(self.panel)
      self.height_ctrl.SetRange(1, 100)
      sizer.Add(self.height_ctrl, 1, wx.EXPAND)
  
      self.matrix_ctrl.Bind(wx.EVT_PAINT, self.on_matrix_ctrl_paint)
      self.matrix_ctrl.Bind(wx.EVT_LEFT_UP, self.on_matrix_ctrl_clicked)
      self.width_ctrl.Bind(wx.EVT_SPINCTRL, self.on_width_changed)
      self.height_ctrl.Bind(wx.EVT_SPINCTRL, self.on_height_changed)
      self.update()
  
file_path: CellProfiler/src/frontend/cellprofiler/gui/module_view/_binary_matrix_controller.py
imports: import wx
  from cellprofiler_core.preferences import get_background_color
  from cellprofiler_core.setting import BinaryMatrix
  from ._module_view import ModuleView
  from ..utilities.module_view import edit_control_name
label_desc: Use image node_id 1 to create a new BinaryMatrixController object  with example: obj = BinaryMatrixController(module_view, v)