Ipython exists

瀏覽次數:54 次
跳到第一則未讀訊息

Sebastian Schaetz

未讀,
2011年10月26日 中午12:35:192011/10/26
收件者:glumpy-users
Hi,

I'm using glumpy as a tool to easily visualize 2d numpy data
interactively from the ipython. My problem is that ipython is not
responsive as long as the glumpy window is open and (more importantly)
that ipython exits after I close the window. I'm on Ubuntu 11.10 x64
and I tried both with ipython 0.11 and the default 0.10.2.

This is the code I use

def showm(data, dim):
# expect 3 dimensional x, y and frame
print data.shape
x = data.shape[0]
y = data.shape[1]

fig = glumpy.figure(size=(x, y))
frame = fig.add_frame(aspect=1)
image = glumpy.image.Image(abs(data[:, :, dim]))

@fig.event
def on_draw():
fig.clear()
frame.draw(x=frame.x, y=frame.y )
image.draw(x=frame.x, y=frame.y, z=0,
width=frame.width, height=frame.height )
fig.show()

and I run it like so from ipython
showm(a,5)

What am I doing wrong?
Thans in advance,
Sebastian

Nicolas Rougier

未讀,
2011年10月26日 下午4:40:022011/10/26
收件者:glumpy-users

Did you enter the glut gui from ipython ?
(You have to type "%gui glut" from the ipython shell or to give it on
the command line)


Nicolas



On Oct 26, 6:35 pm, Sebastian Schaetz <seb.scha...@googlemail.com>
wrote:

Sebastian Schaetz

未讀,
2011年10月27日 上午8:09:282011/10/27
收件者:glumpy-users
On Oct 26, 10:40 pm, Nicolas Rougier <nicolas.roug...@gmail.com>
wrote:
> Did you enter the glut gui from ipython ?
> (You have to type "%gui glut" from the ipython shell or to give it on
> the command line)
>

Indeed that works! Thanks a lot!
回覆所有人
回覆作者
轉寄
0 則新訊息