@xvfb_it
@npt.dec.skipif((not actor.have_vtk))
@npt.dec.skipif((not actor.have_vtk_colors))
def test_text_widget():
    interactive = False
    renderer = window.Renderer()
    axes = fvtk.axes()
    window.add(renderer, axes)
    renderer.ResetCamera()
    show_manager = window.ShowManager(renderer, size=(900, 900))
    if interactive:
        show_manager.initialize()
        show_manager.render()
    fetch_viz_icons()
    button_png = read_viz_icons(fname='home3.png')

    def button_callback(obj, event):
        print('Button Pressed')
    button = widget.button(show_manager.iren, show_manager.ren, button_callback, button_png, (0.8, 1.2), (100, 100))
    global rulez
    rulez = True

    def text_callback(obj, event):
        global rulez
        print('Text selected')
        if rulez:
            obj.GetTextActor().SetInput('Diffusion Imaging Rulez!!')
            rulez = False
        else:
            obj.GetTextActor().SetInput('Diffusion Imaging in Python')
            rulez = True
        show_manager.render()
    text = widget.text(show_manager.iren, show_manager.ren, text_callback, message='Diffusion Imaging in Python', left_down_pos=(0.0, 0.0), right_top_pos=(0.4, 0.05), opacity=1.0, border=False)
    if (not interactive):
        button.Off()
        text.Off()
        pass
    if interactive:
        show_manager.render()
        show_manager.start()
    arr = window.snapshot(renderer, size=(900, 900))
    report = window.analyze_snapshot(arr)
    npt.assert_equal(report.objects, 3)
@xvfb_it
@npt.dec.skipif((not actor.have_vtk))
@npt.dec.skipif((not actor.have_vtk_colors))
def test_text_widget():
    interactive = False
    renderer = window.Renderer()
    axes = fvtk.axes()
    window.add(renderer, axes)
    renderer.ResetCamera()
    show_manager = window.ShowManager(renderer, size=(900, 900))
    if interactive:
        show_manager.initialize()
        show_manager.render()
    fetch_viz_icons()
    button_png = read_viz_icons(fname='home3.png')

    def button_callback(obj, event):
        print('Button Pressed')
    button = widget.button(show_manager.iren, show_manager.ren, button_callback, button_png, (0.8, 1.2), (100, 100))
    global rulez
    rulez = True

    def text_callback(obj, event):
        global rulez
        print('Text selected')
        if rulez:
            obj.GetTextActor().SetInput('Diffusion Imaging Rulez!!')
            rulez = False
        else:
            obj.GetTextActor().SetInput('Diffusion Imaging in Python')
            rulez = True
        show_manager.render()
    text = widget.text(show_manager.iren, show_manager.ren, text_callback, message='Diffusion Imaging in Python', left_down_pos=(0.0, 0.0), right_top_pos=(0.4, 0.05), opacity=1.0, border=False)
    if (not interactive):
        button.Off()
        text.Off()
        pass
    if interactive:
        show_manager.render()
        show_manager.start()
    arr = window.snapshot(renderer, size=(900, 900))
    report = window.analyze_snapshot(arr)
    npt.assert_equal(report.objects, 3)