1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
| import os
import wx
MAIN_WINDOW_DEFAULT_SIZE = (300,200)
class Frame(wx.Frame):
def __init__(self, parent, id, title):
style=wx.DEFAULT_FRAME_STYLE ^ (wx.RESIZE_BORDER)
wx.Frame.__init__(self, parent, id, title=title, size=MAIN_WINDOW_DEFAULT_SIZE, style=style)
self.Center()
self.panel = wx.Panel(self)
self.panel.SetBackgroundColour('White')
self.save_dire(1, 2, 3)
def OnExit(self, event):
self.Destroy()
def save_dire(self, ref, data, module):
def select_chemin():
#self.maj_data()
filename = 'Rapport: %s'%ref
print filename ## Juste pour l'info lors du dev.
wildcard = "Fichier tartanpion (*.tartanpion)|*.tartanpion"
selection = wx.FileDialog(self, 'Enregistrer sous', defaultFile = filename, wildcard = wildcard, style = wx.SAVE)
retour = selection.ShowModal()
chemin = selection.GetPath()
if os.path.isfile(chemin) == 1:
dlg = wx.MessageDialog(self, u'Ce projet existe d\xe9\xe0. Voulez-vous le remplacer?', 'ATTENTION', wx.OK | wx.ICON_WARNING |wx.CANCEL)
if dlg.ShowModal() == wx.ID_OK:
return chemin
else:select_chemin()
else: return chemin
path = select_chemin()
class App(wx.App):
def OnInit(self):
self.frame = Frame(parent=None, id=-1, title='test wx')
self.frame.Show()
self.SetTopWindow(self.frame)
return True
if __name__ == "__main__":
app = App(redirect=False)
app.MainLoop() |
Partager