Python 如何同时使用两张iPysheet。附着细胞心房肌
我想在一个特定的笔记本中呈现两张iPysheet 例如,假设我有:Python 如何同时使用两张iPysheet。附着细胞心房肌,python,jupyter-notebook,ipywidgets,Python,Jupyter Notebook,Ipywidgets,我想在一个特定的笔记本中呈现两张iPysheet 例如,假设我有: mysheet1 = ipysheet.sheet(rows=3, columns=4) mysheet2 = ipysheet.sheet(rows=3, columns=4) 如果我现在这样做: cell1 = ipysheet.cell(0, 0, 'Hello') cell2 = ipysheet.cell(2, 0, 'World') cell_value = ipysheet.cell(2,2, 42.) 表2中
mysheet1 = ipysheet.sheet(rows=3, columns=4)
mysheet2 = ipysheet.sheet(rows=3, columns=4)
如果我现在这样做:
cell1 = ipysheet.cell(0, 0, 'Hello')
cell2 = ipysheet.cell(2, 0, 'World')
cell_value = ipysheet.cell(2,2, 42.)
表2中的值已更改。
这真的很奇怪。为什么创建的最后一张图纸会被修改
为什么跟踪不起作用
cell1 = mysheet1.cell(0, 0, 'Hello')
也不是
我会假设,因为在Pyton ipysheet中all是一个对象,所以它也是一个对象,但它的“cell”不是mysheet1的atribute
有什么合理的解释吗
这实际上可以扩展到列atributes。这是因为,
单元格
根据。一种对我有效的方法是将Cell
作为元组分配给第一个工作表的属性cells
。就是
from ipysheet import sheet, current, cell, Cell
s1 = sheet(rows=3, columns=4)
s2 = sheet(rows=3, columns=4)
cell1 = cell(0, 0, 'Hello', )
cell2 = cell(2, 0, 'World', )
s1.cells = (Cell(column_end=0, column_start=0, row_end=1, row_start=1, type='text', value='Hello'), Cell(column_end=0, column_start=0, row_end=0, row_start=0, type='text', value='Hello'))
还有一个
但我认为这样分配细胞是不现实的,如果先使用
s1
然后再使用s2
会更容易一些,我看不出如何以一种实用的方式在voila中呈现几个ipysheet,这些ipysheet的数据会根据其他ipyWidget(即用户交互)而变化。@Berlines是的,用户所做的所有更改都会转到current()
工作表。因此,目前似乎没有切实可行的方法。
from ipysheet import sheet, current, cell, Cell
s1 = sheet(rows=3, columns=4)
s2 = sheet(rows=3, columns=4)
cell1 = cell(0, 0, 'Hello', )
cell2 = cell(2, 0, 'World', )
s1.cells = (Cell(column_end=0, column_start=0, row_end=1, row_start=1, type='text', value='Hello'), Cell(column_end=0, column_start=0, row_end=0, row_start=0, type='text', value='Hello'))