3
# [SNIPPET_NAME: Wheelbarrow Custom Window]
4
# [SNIPPET_CATEGORIES: PyGTK]
5
# [SNIPPET_DESCRIPTION: Create a custom sized wheelbarrow window]
7
# example wheelbarrow.py
14
WheelbarrowFull_xpm = [
91
"Oh$;ya *3d.a8j,Xe.d3g8+ ",
92
" Oh$;ka *3d$a8lz,,xxc:.e3g54 ",
93
" Oh$;kO *pd$%svbzz,sxxxxfX..&wn> ",
94
" Oh$@mO *3dthwlsslszjzxxxxxxx3:td8M4 ",
95
" Oh$@g& *3d$XNlvvvlllm,mNwxxxxxxxfa.:,B* ",
96
" Oh$@,Od.czlllllzlmmqV@V#V@fxxxxxxxf:%j5& ",
97
" Oh$1hd5lllslllCCZrV#r#:#2AxxxxxxxxxcdwM* ",
98
" OXq6c.%8vvvllZZiqqApA:mq:Xxcpcxxxxxfdc9* ",
99
" 2r<6gde3bllZZrVi7S@SV77A::qApxxxxxxfdcM ",
100
" :,q-6MN.dfmZZrrSS:#riirDSAX@Af5xxxxxfevo",
101
" +A26jguXtAZZZC7iDiCCrVVii7Cmmmxxxxxx%3g",
102
" *#16jszN..3DZZZZrCVSA2rZrV7Dmmwxxxx&en",
103
" p2yFvzssXe:fCZZCiiD7iiZDiDSSZwwxx8e*>",
104
" OA1<jzxwwc:$d%NDZZZZCCCZCCZZCmxxfd.B ",
105
" 3206Bwxxszx%et.eaAp77m77mmmf3&eeeg* ",
106
" @26MvzxNzvlbwfpdettttttttttt.c,n& ",
107
" *;16=lsNwwNwgsvslbwwvccc3pcfu<o ",
108
" p;<69BvwwsszslllbBlllllllu<5+ ",
109
" OS0y6FBlvvvzvzss,u=Blllj=54 ",
110
" c1-699Blvlllllu7k96MMMg4 ",
111
" *10y8n6FjvllllB<166668 ",
112
" S-kg+>666<M<996-y6n<8* ",
113
" p71=4 m69996kD8Z-66698&& ",
114
" &i0ycm6n4 ogk17,0<6666g ",
115
" N-k-<> >=01-kuu666> ",
116
" ,6ky& &46-10ul,66, ",
117
" Ou0<> o66y<ulw<66& ",
118
" *kk5 >66By7=xu664 ",
119
" <<M4 466lj<Mxu66o ",
120
" *>> +66uv,zN666* ",
130
class WheelbarrowExample:
131
# When invoked (via signal delete_event), terminates the application
132
def close_application(self, widget, event, data=None):
137
# Create the main window, and attach delete_event signal to terminate
138
# the application. Note that the main window will not have a titlebar
139
# since we're making it a popup.
140
window = gtk.Window(gtk.WINDOW_POPUP)
141
window.connect("delete_event", self.close_application)
142
window.set_events(window.get_events() | gtk.gdk.BUTTON_PRESS_MASK)
143
window.connect("button_press_event", self.close_application)
146
# Now for the pixmap and the image widget
147
pixmap, mask = gtk.gdk.pixmap_create_from_xpm_d(
148
window.window, None, WheelbarrowFull_xpm)
150
image.set_from_pixmap(pixmap, mask)
153
# To display the image, we use a fixed widget to place the image
155
fixed.set_size_request(200, 200)
156
fixed.put(image, 0, 0)
160
# This masks out everything except for the image itself
161
window.shape_combine_mask(mask, 0, 0)
164
window.set_position(gtk.WIN_POS_CENTER_ALWAYS)
171
if __name__ == "__main__":