2011-05-25 94 views
1

當我嘗試在「文件保存」對話框中保存文件時,需要檢查是否存在相同的文件。 İf它, 它不應該讓我這樣做,並迫使我改變名稱。我如何在WxPython中執行此操作?在WxPython中檢查文件保存對話框中的覆蓋

在此先感謝。

這裏是我的節省代碼:

 #Dosya tipi filtreleri 
     wildcard = "BENGI files (*.bengi)|*.bengi|" \ 
     "SQLITE file (*.sdb)|*.sdb|"  \ 
     "All files (*.*)|*.*" 

     dlg = wx.FileDialog(
      self, message="Save file as ...", defaultDir=DesktopPath, 
      defaultFile="_nokta_listesi", wildcard=wildcard, style=wx.SAVE 
      ) 


     # Varsayılan dosya tipi filtresi 
     dlg.SetFilterIndex(0) 

     # Show the dialog and retrieve the user response. If it is the OK response, 
     # process the data. 
     if dlg.ShowModal() == wx.ID_OK: 
      path = dlg.GetPath() 

      # Create a database in disk 
      con=apsw.Connection(path) 

      # Copy from memory to disk 
      with con.backup("main", self.conn2, "main") as backup: 
       backup.step() # copy whole database in one go 

      con.close(True) 
     dlg.Destroy() 
+3

要麼關閉問題,要麼自己添加答案並接受答案。 – 2011-06-16 15:34:23

+0

「Varsayılandosya tipi filtresi」是什麼意思? – bluenote10 2014-02-07 14:26:32

+0

這意味着「哦兄弟大時間」 – ohbrobig 2015-05-12 06:58:52

回答

2

解決:

我補充說: 「wx.OVERWRITE_PROMPT」 標誌的風格。