~brian-sidebotham/wxwidgets-cmake/wxpython-2.9.4

« back to all changes in this revision

Viewing changes to wxPython/demo/StockButtons.py

  • Committer: Brian Sidebotham
  • Date: 2013-08-03 14:30:08 UTC
  • Revision ID: brian.sidebotham@gmail.com-20130803143008-c7806tkych1tp6fc
Initial import into Bazaar

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
 
 
2
import wx 
 
3
 
 
4
#----------------------------------------------------------------------
 
5
 
 
6
 
 
7
stockIDs = [
 
8
    wx.ID_ABOUT,
 
9
    wx.ID_ADD,
 
10
    wx.ID_APPLY,
 
11
    wx.ID_BOLD,
 
12
    wx.ID_CANCEL,
 
13
    wx.ID_CLEAR,
 
14
    wx.ID_CLOSE,
 
15
    wx.ID_COPY,
 
16
    wx.ID_CUT,
 
17
    wx.ID_DELETE,
 
18
    wx.ID_EDIT,
 
19
    wx.ID_FIND,
 
20
    wx.ID_FILE,
 
21
    wx.ID_REPLACE,
 
22
    wx.ID_BACKWARD,
 
23
    wx.ID_DOWN,
 
24
    wx.ID_FORWARD,
 
25
    wx.ID_UP,
 
26
    wx.ID_HELP,
 
27
    wx.ID_HOME,
 
28
    wx.ID_INDENT,
 
29
    wx.ID_INDEX,
 
30
    wx.ID_ITALIC,
 
31
    wx.ID_JUSTIFY_CENTER,
 
32
    wx.ID_JUSTIFY_FILL,
 
33
    wx.ID_JUSTIFY_LEFT,
 
34
    wx.ID_JUSTIFY_RIGHT,
 
35
    wx.ID_NEW,
 
36
    wx.ID_NO,
 
37
    wx.ID_OK,
 
38
    wx.ID_OPEN,
 
39
    wx.ID_PASTE,
 
40
    wx.ID_PREFERENCES,
 
41
    wx.ID_PRINT,
 
42
    wx.ID_PREVIEW,
 
43
    wx.ID_PROPERTIES,
 
44
    wx.ID_EXIT,
 
45
    wx.ID_REDO,
 
46
    wx.ID_REFRESH,
 
47
    wx.ID_REMOVE,
 
48
    wx.ID_REVERT_TO_SAVED,
 
49
    wx.ID_SAVE,
 
50
    wx.ID_SAVEAS,
 
51
    wx.ID_SELECTALL,
 
52
    wx.ID_STOP,
 
53
    wx.ID_UNDELETE,
 
54
    wx.ID_UNDERLINE,
 
55
    wx.ID_UNDO,
 
56
    wx.ID_UNINDENT,
 
57
    wx.ID_YES,
 
58
    wx.ID_ZOOM_100,
 
59
    wx.ID_ZOOM_FIT,
 
60
    wx.ID_ZOOM_IN,
 
61
    wx.ID_ZOOM_OUT,
 
62
 
 
63
    ]
 
64
 
 
65
class TestPanel(wx.Panel):
 
66
    def __init__(self, parent, log):
 
67
        self.log = log
 
68
        wx.Panel.__init__(self, parent, -1)
 
69
 
 
70
        sizer = wx.FlexGridSizer(cols=5, hgap=4, vgap=4)
 
71
        for ID in stockIDs:
 
72
            b = wx.Button(self, ID)
 
73
            sizer.Add(b)
 
74
 
 
75
        self.SetSizer(sizer)
 
76
        
 
77
 
 
78
#----------------------------------------------------------------------
 
79
 
 
80
def runTest(frame, nb, log):
 
81
    win = TestPanel(nb, log)
 
82
    return win
 
83
 
 
84
#----------------------------------------------------------------------
 
85
 
 
86
 
 
87
 
 
88
overview = """<html><body>
 
89
<h2><center>Stock Buttons</center></h2>
 
90
 
 
91
It is now possible to create \"stock\" buttons.  Basically this means
 
92
that you only have to provide one of the stock IDs (and an empty
 
93
label) when creating the button and wxWidgets will choose the stock
 
94
label to go with it automatically.  Additionally on the platforms that
 
95
have a native concept of a stock button (currently only GTK2) then the
 
96
native stock button will be used.
 
97
 
 
98
<p>This sample shows buttons for all of the currenlty available stock
 
99
IDs.  Notice that when the button is created that no label is given,
 
100
and compare that with the button that is created.
 
101
 
 
102
 
 
103
</body></html>
 
104
"""
 
105
 
 
106
 
 
107
 
 
108
if __name__ == '__main__':
 
109
    import sys,os
 
110
    import run
 
111
    run.main(['', os.path.basename(sys.argv[0])] + sys.argv[1:])
 
112