[vtkusers] VTK + tcl on mac not working the mouse and keyboard events

pablo p del castillo pablodecastillo at yahoo.es
Thu Nov 3 11:52:01 EDT 2011


Hello,

Nobody got similar issues to help??

Thanks


________________________________
De: pablo p del castillo <pablodecastillo at yahoo.es>
Para: "vtkusers at vtk.org" <vtkusers at vtk.org>
Enviado: miércoles 2 de noviembre de 2011 13:09
Asunto: VTK + tcl on mac not working the mouse and keyboard events


Hello,

What is the tip/trick to get working mouse events on Mac. It is working perfectly in Linux and Windows.

Basically the MaceTk.tcl is not working well, allways happend if you add vtkTkRenderWidget.

The terminal says " invalid drawable".

Any idea, thanks??

This the code :

 

package require vtk
package require vtkinteraction

set sphere_max_res 60
set sphere_init_res 8
vtkSphereSource sphere
    sphere SetThetaResolution $sphere_init_res
    sphere SetPhiResolution $sphere_init_res


vtkPolyDataMapper sphereMapper
    sphereMapper SetInputConnection [sphere GetOutputPort]

vtkLODActor sphereActor
    sphereActor SetMapper sphereMapper


vtkConeSource cone
    cone SetResolution 6


vtkGlyph3D glyph
    glyph SetInputConnection [sphere GetOutputPort]
    glyph SetSource [cone GetOutput]
    glyph SetVectorModeToUseNormal 
    glyph SetScaleModeToScaleByVector 
    glyph SetScaleFactor 0.25

vtkPolyDataMapper spikeMapper
    spikeMapper SetInputConnection [glyph GetOutputPort]

vtkLODActor spikeActor
    spikeActor SetMapper spikeMapper

vtkRenderer renderer
    renderer AddActor sphereActor
    renderer AddActor spikeActor
    renderer SetBackground 1 1 1

vtkRenderWindow renWin
    renWin AddRenderer renderer

set vtkw [vtkTkRenderWidget .ren \
        -width 300 \
        -height 300 \
        -rw renWin]

::vtk::bind_tk_render_widget $vtkw

frame .params

set sth [scale .params.sth \
        -from 3 -to $sphere_max_res -res 1 \
        -orient horizontal \
        -label "Sphere Theta Resolution:" \
        -command setSphereThetaResolution]

$sth set [sphere GetThetaResolution]

proc setSphereThetaResolution {res} {
    sphere SetThetaResolution $res
    renWin Render
}

set sph [scale .params.sph \
        -from 3 -to $sphere_max_res -res 1 \
        -orient horizontal \
        -label "Sphere Phi Resolution:" \
        -command setSpherePhiResolution]

$sph set [sphere GetPhiResolution]

proc setSpherePhiResolution {res} {
    sphere SetPhiResolution $res
    renWin Render
}

set cone_max_res $sphere_max_res
set cre [scale .params.cre \
        -from 3 -to $cone_max_res -res 1 \
        -orient horizontal \
        -label "Cone Source Resolution:" \
        -command setConeSourceResolution]

$cre set [cone GetResolution]

proc setConeSourceResolution {res} {
    cone SetResolution $res
    renWin Render
}

set gsc [scale .params.gsc \
        -from 0.1 -to 1.5 -res 0.05 \
        -orient horizontal\
        -label "Glyph Scale Factor:" \
        -command setGlyphScaleFactor]
$gsc set [glyph GetScaleFactor]

proc setGlyphScaleFactor {factor} {
    glyph SetScaleFactor $factor
    renWin Render
}

button .params.quit -text "Quit" -command ::vtk::cb_exit

pack $sth $sph $cre $gsc .params.quit -side top -anchor nw -fill both
pack $vtkw .params -side top -fill both -expand yes

wm protocol . WM_DELETE_WINDOW ::vtk::cb_exit

tkwait window .
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20111103/6e1e64bb/attachment.htm>


More information about the vtkusers mailing list