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

pablo p del castillo pablodecastillo at yahoo.es
Tue Nov 8 06:28:14 EST 2011


I had to add this like for Mac OX, and now working perfectly.

::vtk::bind_tk_render_widget


Pablo


________________________________
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: [vtkusers] 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 .


_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ

Follow this link to subscribe/unsubscribe:
http://www.vtk.org/mailman/listinfo/vtkusers
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20111108/86d0a95a/attachment.htm>


More information about the vtkusers mailing list