I've got some issues using the SaveFileDialog class of .Net in Python 3.4 with the pythonnet package. Above you will see a little sample of code to demonstrate that issue. The code itself works pretty fine until the event of the button click gets fired and the SaveFileDialog should be showed with "dialog.ShowDialog()" the Application freezes and nothing happens at all. Tested the same code with the IronPython interpreter and it worked fine. I have already searched the web for some answers but found nothing related with that issue
import clr
clr.AddReference("System.Windows.Forms")
clr.AddReference("System.Drawing")
from System.Windows.Forms import Form, Application, Button, SaveFileDialog
from System.Drawing import Point
class TestForm(Form):
def __init__(self):
self.button = Button()
self.addButton()
def addButton(self):
self.button.Location = Point(50,50)
self.button.Text = "Save s.th"
self.Controls.Add(self.button)
self.button.Click += self.buttonClick
def buttonClick(self, sender, event):
dialog = SaveFileDialog()
dialog.FileName = "test one"
dialog.Title = "Test One"
print("so far so good")
dialog.ShowDialog()
print("Never reaches this point")
Application.Run(TestForm())