<br><br>On Fri, Jun 10, 2016 at 5:18 AM, Yash Agarwal <agrwal.ysh94@gmail.com> wrote:<br>
<blockquote type="cite"><div dir="ltr">Hi, <div>I'm having trouble implementing  an <a href="https://en.wikipedia.org/wiki/Observer_pattern">observer pattern</a> based Gtk layout.</div></div></blockquote><div><br></div><div>You can use GObject Signals:  `pydoc gi.repository.GObject.Signal`</div><br><blockquote type="cite"><div dir="ltr"><div><br></div><div>This is my current method to dynamically change the layout:</div><div>for implementing <a href="https://raw.githubusercontent.com/sugarlabs/edit-fonts-activity/yash-v0/button_demo.gif">this</a>, a grid with pagination, I'm destroying all the elements of the grid when either of the buttons is pressed and then add the new elements to the grid based on a counter.</div></div></blockquote><div><br></div><div>Do you have the memory to create all the objects, even the invisible ones?</div><div><br></div><div>Alternatively, I'm not sure why you need the observer pattern.  Can you just go:</div><div><br></div><div>    for object in grid:</div><div>        object.change_to_new_thing(new_data[i])</div><br><blockquote type="cite"><div dir="ltr"><div><br></div><div>I don't think this is the most efficient method to do this, hence I need help in implementing observer pattern in this.</div><div><br></div><div>with Regards,</div><div>Yash Agarwal  </div><div> </div></div>
</blockquote>