coding utf-8 import os import wx class MainWindow wx Frame def __init_

 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
#-*- coding: utf-8 -*-
import os
import wx
class MainWindow(wx.Frame):
def __init__(self, parent, title, size):
wx.Frame.__init__(self, parent, title=title, size=size)
self.CreateStatusBar() # A StatusBar in the bottom of the window
# Setting up the menu.
filemenu= wx.Menu()
menu_exit = filemenu.Append(wx.ID_EXIT, "Exit", "Exit from app")
menu_about = filemenu.Append(wx.ID_ABOUT, "About", "About dialog")
menu_bar = wx.MenuBar()
menu_bar.Append(filemenu, "File")
self.SetMenuBar(menu_bar)
# Set events.
self.Bind(wx.EVT_MENU, self.on_about, menu_about)
self.Bind(wx.EVT_MENU, self.on_exit, menu_exit)
# Main layout
self.layer = wx.BoxSizer(wx.HORIZONTAL)
left_block = wx.Panel(self)
left_block.SetBackgroundColour("GRAY")
right_block = wx.Panel(self)
right_block.SetBackgroundColour("#ededed")
# Add buttons to left block
btn_reload = wx.Button(left_block, label="Reload", pos=(0, 0))
btn_create = wx.Button(left_block, label="Upload", pos=(150, 0))
self.layer.Add(left_block, 1, wx.EXPAND)
self.layer.Add(right_block, 2, wx.EXPAND)
self.SetSizer(self.layer)
self.SetAutoLayout(1)
self.Show(True)
def on_about(self,e):
dlg = wx.MessageDialog(self, "Title", "Text", wx.OK)
dlg.ShowModal()
dlg.Destroy()
def on_exit(self,e):
self.Close(True)
app = wx.App(False)
frame = MainWindow(None, "Sample editor", size=(800, 600))
app.MainLoop()