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 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73
|
#!/usr/bin/python
# -*- coding: iso-8859-1 -*-
import wx
import os,sys
#Fichier main.py
class Onglet_un(wx.Panel):
def __init__(self, parent):
wx.Panel.__init__(self, parent,style= wx.EXPAND)
pane3 = wx.Panel(self, -1)
Zone_de_texte = wx.TextCtrl(self,size=(-1,-1),style=wx.TE_MULTILINE | wx.TE_PROCESS_ENTER | wx.EXPAND)
Zone_de_texte.SetFocus()
class Onglet_deux(wx.Panel):
def __init__(self, parent):
wx.Panel.__init__(self, parent)
class Onglet_trois(wx.Panel):
def __init__(self, parent):
wx.Panel.__init__(self, parent)
class Fenetre_principale(wx.Frame):
def __init__(self, parent, id, title):
wx.Frame.__init__(self, parent, id, title,size=(640, 480))
# Contenu de la fenêtre principale
# Le menu
panel = wx.Panel(self, -1)
Lemenu = wx.MenuBar()
Fichiermenu = wx.Menu()
Menu_nouveau = wx.MenuItem(Fichiermenu,002, '&Nouveau document\tCtrl+N', 'Creer un nouveau document')
Menu_nouveau.SetBitmap(wx.Bitmap('./Icones/Ouverture.png'))
Fichiermenu.AppendItem(Menu_nouveau)
Fichiermenu.AppendSeparator()
Menu_quitter = wx.MenuItem(Fichiermenu,001, '&Quitter l\'application\tCtrl+Q', 'Quitter l\'application')
Menu_quitter.SetBitmap(wx.Bitmap('./Icones/Fermeture.png'))
Fichiermenu.AppendItem(Menu_quitter)
#Barre d'outils
self.barreoutils = self.CreateToolBar(wx.TB_HORIZONTAL | wx.BORDER | wx.TB_FLAT | wx.TB_TEXT )
#Onglets
Cadre_notebook = wx.Notebook(panel, wx.EXPAND)
nb_un = Onglet_un(Cadre_notebook)
#Déclaration des pages
Cadre_notebook.AddPage(nb_un, "Sans titre")
sizer = wx.BoxSizer()
sizer.Add(Cadre_notebook, 1, wx.EXPAND)
panel.SetSizer(sizer)
#Déclaration du menu
Lemenu.Append(Fichiermenu, '&Fichier')
self.SetMenuBar(Lemenu)
#Evenements
self.Bind(wx.EVT_TOOL, self.Fermeture,id=001)
def Fermeture(self,event):
self.Destroy()
class MonApp(wx.App):
def OnInit(self):
#Icone_application = wx.Icon('./Icones/iconeapplication.png', wx.BITMAP_TYPE_ANY)
frame = Fenetre_principale(None, -1, 'Mon application')
#frame.SetIcon(Icone_application)
self.SetTopWindow(frame)
frame.CenterOnParent()
frame.Show(True)
return True
app = MonApp()
app.MainLoop() |
Partager