I have a vtkpolydata and i know how to save it like stl:

    stlWriter = vtk.vtkSTLWriter()
    stlWriter.SetFileName("gomaMI.stl")
    stlWriter.SetInputConnection(self.modeloMI.GetOutputPort())
    stlWriter.Write()

The problem is that i dont want to save it by code I want to specify the folder and name in a new window, like all programs. Any suggestion?

1 Answers

1
g.stevo On Best Solutions
from tkinter import Tk
from tkinter.filedialog import asksaveasfilename

Tk().withdraw() 
filename = asksaveasfilename()
print(filename)

As per your code if you SetFileName to whatever is returned by filename assuming it isn't an empty string this will work.

PyQt5 is nicer to look at but requires more lines of code easygui would also offer a solution.