WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 09-23-2010, 11:07 AM
migoloco migoloco is offline
Member
 
Join Date: Sep 2010
Posts: 5
Winviz.exe does not "finish". (Pylab problem)

Hi, I am using the following simple script to demonstrate the problem. Winviz.exe does not close from the task manager after I trigger the makeachart() by keypressing 1.

However, the same does not happen if I execute the function directly, instead of calling it through vizact.onkeydown('1', makeachart, "file.png"). Am I doing something wrong? Thanks.
import wx
import viz
#--
import matplotlib
matplotlib.use('WXAgg')
#--
import pylab

def makeachart(f):
x = pylab.arange(1961, 2031, 1)
y = pylab.sin(2 * pylab.pi * x)
pylab.plot(x, y, linewidth=2.0)
pylab.savefig(f, format='png')

vizact.onkeydown('1', makeachart, "file.png")

class VizardFrame(wx.Frame):
def __init__(self, parent):
wx.Frame.__init__( self,
parent,
-1,
"Vizard Embedded Example",
size=(800,600),
style=wx.DEFAULT_FRAME_STYLE )
window = wx.Window(self,-1)
viz.go(viz.EMBEDDED,window.GetHandle())
quad = viz.addTexQuad( pos=(0,1.6,5) )
quad.color(viz.RED)
quad.disable(viz.LIGHTING)
quad.addAction(vizact.spin(0,1,0,90))
self.timer = wx.Timer(self)
self.timer.Start(10)
self.Bind(wx.EVT_TIMER, self.OnTimer)

def OnTimer(self, event):
if viz.done():
self.Destroy()
return
viz.updateFrame()

if __name__ == '__main__':
app = wx.PySimpleApp()
frame = VizardFrame(None)
frame.Show(True)
app.MainLoop()
Reply With Quote
  #2  
Old 09-23-2010, 11:42 AM
migoloco migoloco is offline
Member
 
Join Date: Sep 2010
Posts: 5
This problem was surprisingly easy to solve... all I did was:

import matplotlib
matplotlib.use('Agg')


Thank you
Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
win32ui winviz.exe has stopped working TarkaDahl Vizard 3 08-10-2010 05:19 PM
winviz.exe problem llqqff Vizard 2 07-16-2010 09:08 AM
export problem bazelaisr Vizard 2 05-28-2008 10:19 AM
5DT Data Glove 5 Ultra Problem bjgold Vizard 1 08-08-2006 04:08 PM
problem with female animations vmonkey Vizard 1 10-07-2005 10:36 AM


All times are GMT -7. The time now is 11:21 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2019, vBulletin Solutions, Inc.
Copyright 2002-2018 WorldViz LLC