simplified

This commit is contained in:
Martin Diehl 2021-02-11 21:56:53 +01:00
parent e855083964
commit e8fae6b2a7
1 changed files with 14 additions and 16 deletions

View File

@ -347,23 +347,21 @@ class VTK:
See http://compilatrix.com/article/vtk-1 for further ideas. See http://compilatrix.com/article/vtk-1 for further ideas.
""" """
def screen_size(): try:
import wx
_ = wx.App(False) # noqa
width, height = wx.GetDisplaySize()
except ImportError:
try: try:
import wx import tkinter
_ = wx.App(False) # noqa tk = tkinter.Tk()
width, height = wx.GetDisplaySize() width = tk.winfo_screenwidth()
except ImportError: height = tk.winfo_screenheight()
try: tk.destroy()
import tkinter except Exception as e:
tk = tkinter.Tk() width = 1024
width = tk.winfo_screenwidth() height = 768
height = tk.winfo_screenheight()
tk.destroy()
except Exception as e:
width = 1024
height = 768
return (width,height)
mapper = vtk.vtkDataSetMapper() mapper = vtk.vtkDataSetMapper()
mapper.SetInputData(self.vtk_data) mapper.SetInputData(self.vtk_data)
actor = vtk.vtkActor() actor = vtk.vtkActor()
@ -377,7 +375,7 @@ class VTK:
ren.AddActor(actor) ren.AddActor(actor)
ren.SetBackground(0.2,0.2,0.2) ren.SetBackground(0.2,0.2,0.2)
window.SetSize(screen_size[0],screen_size[1]) window.SetSize(width,height)
iren = vtk.vtkRenderWindowInteractor() iren = vtk.vtkRenderWindowInteractor()
iren.SetRenderWindow(window) iren.SetRenderWindow(window)