MCPcopy
hub / github.com/ManimCommunity/manim / get_cell

Method get_cell

manim/mobject/table.py:756–811  ·  view source on GitHub ↗

Returns one specific cell as a rectangular :class:`~.Polygon` without the entry. Parameters ---------- pos The position of a specific entry on the table. ``(1,1)`` being the top left entry of the table. kwargs Additional arguments

(self, pos: Sequence[int] = (1, 1), **kwargs)

Source from the content-addressed store, hash-verified

754 return self
755
756 def get_cell(self, pos: Sequence[int] = (1, 1), **kwargs) -> Polygon:
757 """Returns one specific cell as a rectangular :class:`~.Polygon` without the entry.
758
759 Parameters
760 ----------
761 pos
762 The position of a specific entry on the table. ``(1,1)`` being the top left entry
763 of the table.
764 kwargs
765 Additional arguments to be passed to :class:`~.Polygon`.
766
767 Returns
768 -------
769 :class:`~.Polygon`
770 Polygon mimicking one specific cell of the Table.
771
772 Examples
773 --------
774
775 .. manim:: GetCellExample
776 :save_last_frame:
777
778 class GetCellExample(Scene):
779 def construct(self):
780 table = Table(
781 [["First", "Second"],
782 ["Third","Fourth"]],
783 row_labels=[Text("R1"), Text("R2")],
784 col_labels=[Text("C1"), Text("C2")])
785 cell = table.get_cell((2,2), color=RED)
786 self.add(table, cell)
787 """
788 row = self.get_rows()[pos[0] - 1]
789 col = self.get_columns()[pos[1] - 1]
790 edge_UL = [
791 col.get_left()[0] - self.h_buff / 2,
792 row.get_top()[1] + self.v_buff / 2,
793 0,
794 ]
795 edge_UR = [
796 col.get_right()[0] + self.h_buff / 2,
797 row.get_top()[1] + self.v_buff / 2,
798 0,
799 ]
800 edge_DL = [
801 col.get_left()[0] - self.h_buff / 2,
802 row.get_bottom()[1] - self.v_buff / 2,
803 0,
804 ]
805 edge_DR = [
806 col.get_right()[0] + self.h_buff / 2,
807 row.get_bottom()[1] - self.v_buff / 2,
808 0,
809 ]
810 rec = Polygon(edge_UL, edge_UR, edge_DR, edge_DL, **kwargs)
811 return rec
812
813 def get_highlighted_cell(

Callers 1

get_highlighted_cellMethod · 0.95

Calls 7

get_rowsMethod · 0.95
get_columnsMethod · 0.95
PolygonClass · 0.90
get_leftMethod · 0.45
get_topMethod · 0.45
get_rightMethod · 0.45
get_bottomMethod · 0.45

Tested by

no test coverage detected