pygame / docs / ref / display.html

  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
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    
    <title>pygame.display &mdash; Pygame v1.9.2 documentation</title>
    <link rel="stylesheet" href="../_static/pygame.css" type="text/css" />
    <link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
    <script type="text/javascript">
      var DOCUMENTATION_OPTIONS = {
        URL_ROOT:    '../',
        VERSION:     '1.9.2',
        COLLAPSE_INDEX: false,
        FILE_SUFFIX: '.html',
        HAS_SOURCE:  true
      };
    </script>
    <script type="text/javascript" src="../_static/jquery.js"></script>
    <script type="text/javascript" src="../_static/underscore.js"></script>
    <script type="text/javascript" src="../_static/doctools.js"></script>
    <link rel="shortcut icon" href="../_static/pygame.ico"/>
    <link rel="top" title="Pygame v1.9.2 documentation" href="../index.html" />
    <link rel="next" title="pygame.draw" href="draw.html" />
    <link rel="prev" title="pygame.cursors" href="cursors.html" /> 
  </head>
  <body>  

    <div class="document">

  <div class="header">
    <table>
      <tr>
	<td class="logo">
	  <a href="http://www.pygame.org/">
	    <img src="../_static/pygame_tiny.png"/>
	  </a>
	  <h5>pygame documentation</h5>
	</td>
	<td class="pagelinks">
	  <p class="top">
	    ||
	    <a href="http://www.pygame.org/">Pygame Home</a> ||
	    <a href="../index.html">Help Contents</a> ||
	    <a href="../genindex.html">Reference Index</a> ||
	  </p>
	  <p class="bottom">
	    <a href="camera.html">camera</a> || 
	    <a href="cdrom.html">cdrom</a> || 
	    <a href="color.html">Color</a> || 
	    <a href="cursors.html">cursors</a> || 
	    <a href="display.html">display</a> || 
	    <a href="draw.html">draw</a> || 
	    <a href="event.html">event</a> || 
	    <a href="examples.html">examples</a> || 
	    <a href="font.html">font</a> || 
	    <a href="freetype.html">freetype</a> || 
	    <a href="gfxdraw.html">gfxdraw</a> || 
	    <a href="image.html">image</a> || 
	    <a href="joystick.html">joystick</a> || 
	    <a href="key.html">key</a> || 
	    <a href="locals.html">locals</a> || 
	    <a href="mask.html">mask</a> || 
	    <a href="math.html">math</a> || 
	    <a href="midi.html">midi</a> || 
	    <a href="mixer.html">mixer</a> || 
	    <a href="mouse.html">mouse</a> || 
	    <a href="movie.html">movie</a> || 
	    <a href="music.html">music</a> || 
	    <a href="overlay.html">Overlay</a> || 
	    <a href="pixelarray.html">PixelArray</a> || 
	    <a href="pixelcopy.html">pixelcopy</a> || 
	    <a href="pygame.html">pygame</a> || 
	    <a href="rect.html">Rect</a> || 
	    <a href="scrap.html">scrap</a> || 
	    <a href="sndarray.html">sndarray</a> || 
	    <a href="sprite.html">sprite</a> || 
	    <a href="surface.html">Surface</a> || 
	    <a href="surfarray.html">surfarray</a> || 
	    <a href="tests.html">tests</a> || 
	    <a href="time.html">time</a> || 
	    <a href="transform.html">transform</a> || 
	    <a href="pygame.html#module-pygame.version">version</a>
	  </p>
	</td>
      </tr>
    </table>
  </div>

      <div class="documentwrapper">
          <div class="body">
            
  <div class="sectionwrapper">
<div class="section" id="module-pygame.display">
<span id="pygame-display"></span><dl class="definition module">
<dt class="title module">
<tt class="docutils literal"><span class="pre">pygame.display</span></tt></dt>
<dd><div class="line-block">
<div class="line"><span class="summaryline">pygame module to control the display window and screen</span></div>
</div>
<table border="1" class="toc docutils">
<colgroup>
<col width="34%" />
<col width="1%" />
<col width="65%" />
</colgroup>
<tbody valign="top">
<tr><td><a class="toc reference external" href="display.html#pygame.display.init">pygame.display.init</a></td>
<td></td>
<td>initialize the display module</td>
</tr>
<tr><td><a class="toc reference external" href="display.html#pygame.display.quit">pygame.display.quit</a></td>
<td></td>
<td>uninitialize the display module</td>
</tr>
<tr><td><a class="toc reference external" href="display.html#pygame.display.get_init">pygame.display.get_init</a></td>
<td></td>
<td>true if the display module is initialized</td>
</tr>
<tr><td><a class="toc reference external" href="display.html#pygame.display.set_mode">pygame.display.set_mode</a></td>
<td></td>
<td>initialize a window or screen for display</td>
</tr>
<tr><td><a class="toc reference external" href="display.html#pygame.display.get_surface">pygame.display.get_surface</a></td>
<td></td>
<td>get a reference to the currently set display surface</td>
</tr>
<tr><td><a class="toc reference external" href="display.html#pygame.display.flip">pygame.display.flip</a></td>
<td></td>
<td>update the full display Surface to the screen</td>
</tr>
<tr><td><a class="toc reference external" href="display.html#pygame.display.update">pygame.display.update</a></td>
<td></td>
<td>update portions of the screen for software displays</td>
</tr>
<tr><td><a class="toc reference external" href="display.html#pygame.display.get_driver">pygame.display.get_driver</a></td>
<td></td>
<td>get the name of the pygame display backend</td>
</tr>
<tr><td><a class="toc reference external" href="display.html#pygame.display.Info">pygame.display.Info</a></td>
<td></td>
<td>Create a video display information object</td>
</tr>
<tr><td><a class="toc reference external" href="display.html#pygame.display.get_wm_info">pygame.display.get_wm_info</a></td>
<td></td>
<td>Get information about the current windowing system</td>
</tr>
<tr><td><a class="toc reference external" href="display.html#pygame.display.list_modes">pygame.display.list_modes</a></td>
<td></td>
<td>get list of available fullscreen modes</td>
</tr>
<tr><td><a class="toc reference external" href="display.html#pygame.display.mode_ok">pygame.display.mode_ok</a></td>
<td></td>
<td>pick the best color depth for a display mode</td>
</tr>
<tr><td><a class="toc reference external" href="display.html#pygame.display.gl_get_attribute">pygame.display.gl_get_attribute</a></td>
<td></td>
<td>get the value for an opengl flag for the current display</td>
</tr>
<tr><td><a class="toc reference external" href="display.html#pygame.display.gl_set_attribute">pygame.display.gl_set_attribute</a></td>
<td></td>
<td>request an opengl display attribute for the display mode</td>
</tr>
<tr><td><a class="toc reference external" href="display.html#pygame.display.get_active">pygame.display.get_active</a></td>
<td></td>
<td>true when the display is active on the display</td>
</tr>
<tr><td><a class="toc reference external" href="display.html#pygame.display.iconify">pygame.display.iconify</a></td>
<td></td>
<td>iconify the display surface</td>
</tr>
<tr><td><a class="toc reference external" href="display.html#pygame.display.toggle_fullscreen">pygame.display.toggle_fullscreen</a></td>
<td></td>
<td>switch between fullscreen and windowed displays</td>
</tr>
<tr><td><a class="toc reference external" href="display.html#pygame.display.set_gamma">pygame.display.set_gamma</a></td>
<td></td>
<td>change the hardware gamma ramps</td>
</tr>
<tr><td><a class="toc reference external" href="display.html#pygame.display.set_gamma_ramp">pygame.display.set_gamma_ramp</a></td>
<td></td>
<td>change the hardware gamma ramps with a custom lookup</td>
</tr>
<tr><td><a class="toc reference external" href="display.html#pygame.display.set_icon">pygame.display.set_icon</a></td>
<td></td>
<td>change the system image for the display window</td>
</tr>
<tr><td><a class="toc reference external" href="display.html#pygame.display.set_caption">pygame.display.set_caption</a></td>
<td></td>
<td>set the current window caption</td>
</tr>
<tr><td><a class="toc reference external" href="display.html#pygame.display.get_caption">pygame.display.get_caption</a></td>
<td></td>
<td>get the current window caption</td>
</tr>
<tr><td><a class="toc reference external" href="display.html#pygame.display.set_palette">pygame.display.set_palette</a></td>
<td></td>
<td>set the display color palette for indexed displays</td>
</tr>
</tbody>
</table>
<p>This module offers control over the pygame display. Pygame has a single display
Surface that is either contained in a window or runs full screen. Once you
create the display you treat it as a regular Surface. Changes are not
immediately visible onscreen, you must choose one of the two flipping functions
to update the actual display.</p>
<p>The origin of the display, where x = 0, and y = 0 is the top left of the
screen. Both axis increase positively towards the botom right of the screen.</p>
<p>The pygame display can actually be initialized in one of several modes. By
default the display is a basic software driven framebuffer. You can request
special modules like hardware acceleration and OpenGL support. These are
controlled by flags passed to <tt class="docutils literal"><span class="pre">pygame.display.set_mode()</span></tt>.</p>
<p>Pygame can only have a single display active at any time. Creating a new one
with <tt class="docutils literal"><span class="pre">pygame.display.set_mode()</span></tt> will close the previous display. If precise
control is needed over the pixel format or display resolutions, use the
functions <tt class="docutils literal"><span class="pre">pygame.display.mode_ok()</span></tt>, <tt class="docutils literal"><span class="pre">pygame.display.list_modes()</span></tt>, and
<tt class="docutils literal"><span class="pre">pygame.display.Info()</span></tt> to query information about the display.</p>
<p>Once the display Surface is created, the functions from this module effect the
single existing display. The Surface becomes invalid if the module is
uninitialized. If a new display mode is set, the existing Surface will
automatically switch to operate on the new display.</p>
<p>Then the display mode is set, several events are placed on the pygame event
queue. <tt class="docutils literal"><span class="pre">pygame.QUIT</span></tt> is sent when the user has requested the program to
shutdown. The window will receive <tt class="docutils literal"><span class="pre">pygame.ACTIVEEVENT</span></tt> events as the display
gains and loses input focus. If the display is set with the
<tt class="docutils literal"><span class="pre">pygame.RESIZABLE</span></tt> flag, <tt class="docutils literal"><span class="pre">pygame.VIDEORESIZE</span></tt> events will be sent when the
user adjusts the window dimensions. Hardware displays that draw direct to the
screen will get <tt class="docutils literal"><span class="pre">pygame.VIDEOEXPOSE</span></tt> events when portions of the window must
be redrawn.</p>
<dl class="definition function">
<dt class="title" id="pygame.display.init">
<tt class="descclassname">pygame.display.</tt><tt class="descname">init</tt><big>(</big><big>)</big><a class="headerlink" href="#pygame.display.init" title="Permalink to this definition"></a></dt>
<dd><div class="line-block">
<div class="line"><span class="summaryline">initialize the display module</span></div>
<div class="line"><span class="signature">init() -&gt; None</span></div>
</div>
<p>Initializes the pygame display module. The display module cannot do anything
until it is initialized. This is usually handled for you automatically when
you call the higher level <tt class="docutils literal"><span class="pre">pygame.init()</span></tt>.</p>
<p>Pygame will select from one of several internal display backends when it is
initialized. The display mode will be chosen depending on the platform and
permissions of current user. Before the display module is initialized the
environment variable <tt class="docutils literal"><span class="pre">SDL_VIDEODRIVER</span></tt> can be set to control which backend
is used. The systems with multiple choices are listed here.</p>
<div class="highlight-python"><pre>Windows : windib, directx
Unix    : x11, dga, fbcon, directfb, ggi, vgl, svgalib, aalib</pre>
</div>
<p>On some platforms it is possible to embed the pygame display into an already
existing window. To do this, the environment variable <tt class="docutils literal"><span class="pre">SDL_WINDOWID</span></tt> must
be set to a string containing the window id or handle. The environment
variable is checked when the pygame display is initialized. Be aware that
there can be many strange side effects when running in an embedded display.</p>
<p>It is harmless to call this more than once, repeated calls have no effect.</p>
</dd></dl>

<dl class="definition function">
<dt class="title" id="pygame.display.quit">
<tt class="descclassname">pygame.display.</tt><tt class="descname">quit</tt><big>(</big><big>)</big><a class="headerlink" href="#pygame.display.quit" title="Permalink to this definition"></a></dt>
<dd><div class="line-block">
<div class="line"><span class="summaryline">uninitialize the display module</span></div>
<div class="line"><span class="signature">quit() -&gt; None</span></div>
</div>
<p>This will shut down the entire display module. This means any active
displays will be closed. This will also be handled automatically when the
program exits.</p>
<p>It is harmless to call this more than once, repeated calls have no effect.</p>
</dd></dl>

<dl class="definition function">
<dt class="title" id="pygame.display.get_init">
<tt class="descclassname">pygame.display.</tt><tt class="descname">get_init</tt><big>(</big><big>)</big><a class="headerlink" href="#pygame.display.get_init" title="Permalink to this definition"></a></dt>
<dd><div class="line-block">
<div class="line"><span class="summaryline">true if the display module is initialized</span></div>
<div class="line"><span class="signature">get_init() -&gt; bool</span></div>
</div>
<p>Returns True if the <a class="tooltip reference internal" href="#module-pygame.display" title=""><tt class="xref py py-mod docutils literal"><span class="pre">pygame.display</span></tt><span class="tooltip-content">pygame module to control the display window and screen</span></a> module is currently initialized.</p>
</dd></dl>

<dl class="definition function">
<dt class="title" id="pygame.display.set_mode">
<tt class="descclassname">pygame.display.</tt><tt class="descname">set_mode</tt><big>(</big><big>)</big><a class="headerlink" href="#pygame.display.set_mode" title="Permalink to this definition"></a></dt>
<dd><div class="line-block">
<div class="line"><span class="summaryline">initialize a window or screen for display</span></div>
<div class="line"><span class="signature">set_mode(resolution=(0,0), flags=0, depth=0) -&gt; Surface</span></div>
</div>
<p>This function will create a display Surface. The arguments passed in are
requests for a display type. The actual created display will be the best
possible match supported by the system.</p>
<p>The resolution argument is a pair of numbers representing the width and
height. The flags argument is a collection of additional options. The depth
argument represents the number of bits to use for color.</p>
<p>The Surface that gets returned can be drawn to like a regular Surface but
changes will eventually be seen on the monitor.</p>
<p>If no resolution is passed or is set to (0, 0) and pygame uses <tt class="docutils literal"><span class="pre">SDL</span></tt>
version 1.2.10 or above, the created Surface will have the same size as the
current screen resolution. If only the width or height are set to 0, the
Surface will have the same width or height as the screen resolution. Using a
<tt class="docutils literal"><span class="pre">SDL</span></tt> version prior to 1.2.10 will raise an exception.</p>
<p>It is usually best to not pass the depth argument. It will default to the
best and fastest color depth for the system. If your game requires a
specific color format you can control the depth with this argument. Pygame
will emulate an unavailable color depth which can be slow.</p>
<p>When requesting fullscreen display modes, sometimes an exact match for the
requested resolution cannot be made. In these situations pygame will select
the closest compatable match. The returned surface will still always match
the requested resolution.</p>
<p>The flags argument controls which type of display you want. There are
several to choose from, and you can even combine multiple types using the
bitwise or operator, (the pipe &#8220;|&#8221; character). If you pass 0 or no flags
argument it will default to a software driven window. Here are the display
flags you will want to choose from:</p>
<div class="highlight-python"><pre>pygame.FULLSCREEN    create a fullscreen display
pygame.DOUBLEBUF     recommended for HWSURFACE or OPENGL
pygame.HWSURFACE     hardware accelerated, only in FULLSCREEN
pygame.OPENGL        create an opengl renderable display
pygame.RESIZABLE     display window should be sizeable
pygame.NOFRAME       display window will have no border or controls</pre>
</div>
</dd></dl>

<dl class="definition function">
<dt class="title" id="pygame.display.get_surface">
<tt class="descclassname">pygame.display.</tt><tt class="descname">get_surface</tt><big>(</big><big>)</big><a class="headerlink" href="#pygame.display.get_surface" title="Permalink to this definition"></a></dt>
<dd><div class="line-block">
<div class="line"><span class="summaryline">get a reference to the currently set display surface</span></div>
<div class="line"><span class="signature">get_surface() -&gt; Surface</span></div>
</div>
<p>Return a reference to the currently set display Surface. If no display mode
has been set this will return None.</p>
</dd></dl>

<dl class="definition function">
<dt class="title" id="pygame.display.flip">
<tt class="descclassname">pygame.display.</tt><tt class="descname">flip</tt><big>(</big><big>)</big><a class="headerlink" href="#pygame.display.flip" title="Permalink to this definition"></a></dt>
<dd><div class="line-block">
<div class="line"><span class="summaryline">update the full display Surface to the screen</span></div>
<div class="line"><span class="signature">flip() -&gt; None</span></div>
</div>
<p>This will update the contents of the entire display. If your display mode is
using the flags <tt class="docutils literal"><span class="pre">pygame.HWSURFACE</span></tt> and <tt class="docutils literal"><span class="pre">pygame.DOUBLEBUF</span></tt>, this will
wait for a vertical retrace and swap the surfaces. If you are using a
different type of display mode, it will simply update the entire contents of
the surface.</p>
<p>When using an <tt class="docutils literal"><span class="pre">pygame.OPENGL</span></tt> display mode this will perform a gl buffer
swap.</p>
</dd></dl>

<dl class="definition function">
<dt class="title" id="pygame.display.update">
<tt class="descclassname">pygame.display.</tt><tt class="descname">update</tt><big>(</big><big>)</big><a class="headerlink" href="#pygame.display.update" title="Permalink to this definition"></a></dt>
<dd><div class="line-block">
<div class="line"><span class="summaryline">update portions of the screen for software displays</span></div>
<div class="line"><span class="signature">update(rectangle=None) -&gt; None</span></div>
<div class="line"><span class="signature">update(rectangle_list) -&gt; None</span></div>
</div>
<p>This function is like an optimized version of <tt class="docutils literal"><span class="pre">pygame.display.flip()</span></tt> for
software displays. It allows only a portion of the screen to updated,
instead of the entire area. If no argument is passed it updates the entire
Surface area like <tt class="docutils literal"><span class="pre">pygame.display.flip()</span></tt>.</p>
<p>You can pass the function a single rectangle, or a sequence of rectangles.
It is more efficient to pass many rectangles at once than to call update
multiple times with single or a partial list of rectangles. If passing a
sequence of rectangles it is safe to include None values in the list, which
will be skipped.</p>
<p>This call cannot be used on <tt class="docutils literal"><span class="pre">pygame.OPENGL</span></tt> displays and will generate an
exception.</p>
</dd></dl>

<dl class="definition function">
<dt class="title" id="pygame.display.get_driver">
<tt class="descclassname">pygame.display.</tt><tt class="descname">get_driver</tt><big>(</big><big>)</big><a class="headerlink" href="#pygame.display.get_driver" title="Permalink to this definition"></a></dt>
<dd><div class="line-block">
<div class="line"><span class="summaryline">get the name of the pygame display backend</span></div>
<div class="line"><span class="signature">get_driver() -&gt; name</span></div>
</div>
<p>Pygame chooses one of many available display backends when it is
initialized. This returns the internal name used for the display backend.
This can be used to provide limited information about what display
capabilities might be accelerated. See the <tt class="docutils literal"><span class="pre">SDL_VIDEODRIVER</span></tt> flags in
<tt class="docutils literal"><span class="pre">pygame.display.set_mode()</span></tt> to see some of the common options.</p>
</dd></dl>

<dl class="definition function">
<dt class="title" id="pygame.display.Info">
<tt class="descclassname">pygame.display.</tt><tt class="descname">Info</tt><big>(</big><big>)</big><a class="headerlink" href="#pygame.display.Info" title="Permalink to this definition"></a></dt>
<dd><div class="line-block">
<div class="line"><span class="summaryline">Create a video display information object</span></div>
<div class="line"><span class="signature">Info() -&gt; VideoInfo</span></div>
</div>
<p>Creates a simple object containing several attributes to describe the
current graphics environment. If this is called before
<tt class="docutils literal"><span class="pre">pygame.display.set_mode()</span></tt> some platforms can provide information about
the default display mode. This can also be called after setting the display
mode to verify specific display options were satisfied. The VidInfo object
has several attributes:</p>
<div class="highlight-python"><pre>hw:         True if the display is hardware accelerated
wm:         True if windowed display modes can be used
video_mem:  The megabytes of video memory on the display. This is 0 if unknown
bitsize:    Number of bits used to store each pixel
bytesize:   Number of bytes used to store each pixel
masks:      Four values used to pack RGBA values into pixels
shifts:     Four values used to pack RGBA values into pixels
losses:     Four values used to pack RGBA values into pixels
blit_hw:    True if hardware Surface blitting is accelerated
blit_hw_CC: True if hardware Surface colorkey blitting is accelerated
blit_hw_A:  True if hardware Surface pixel alpha blitting is accelerated
blit_sw:    True if software Surface blitting is accelerated
blit_sw_CC: True if software Surface colorkey blitting is accelerated
blit_sw_A:  True if software Surface pixel alpha blitting is acclerated
current_h, current_h:  Width and height of the current video mode, or of the
  desktop mode if called before the display.set_mode is called.
  (current_h, current_w are available since SDL 1.2.10, and pygame 1.8.0)
  They are -1 on error, or if an old SDL is being used.</pre>
</div>
</dd></dl>

<dl class="definition function">
<dt class="title" id="pygame.display.get_wm_info">
<tt class="descclassname">pygame.display.</tt><tt class="descname">get_wm_info</tt><big>(</big><big>)</big><a class="headerlink" href="#pygame.display.get_wm_info" title="Permalink to this definition"></a></dt>
<dd><div class="line-block">
<div class="line"><span class="summaryline">Get information about the current windowing system</span></div>
<div class="line"><span class="signature">get_wm_info() -&gt; dict</span></div>
</div>
<p>Creates a dictionary filled with string keys. The strings and values are
arbitrarily created by the system. Some systems may have no information and
an empty dictionary will be returned. Most platforms will return a &#8220;window&#8221;
key with the value set to the system id for the current display.</p>
<p>New with pygame 1.7.1</p>
</dd></dl>

<dl class="definition function">
<dt class="title" id="pygame.display.list_modes">
<tt class="descclassname">pygame.display.</tt><tt class="descname">list_modes</tt><big>(</big><big>)</big><a class="headerlink" href="#pygame.display.list_modes" title="Permalink to this definition"></a></dt>
<dd><div class="line-block">
<div class="line"><span class="summaryline">get list of available fullscreen modes</span></div>
<div class="line"><span class="signature">list_modes(depth=0, flags=pygame.FULLSCREEN) -&gt; list</span></div>
</div>
<p>This function returns a list of possible dimensions for a specified color
depth. The return value will be an empty list if no display modes are
available with the given arguments. A return value of -1 means that any
requested resolution should work (this is likely the case for windowed
modes). Mode sizes are sorted from biggest to smallest.</p>
<p>If depth is 0, <tt class="docutils literal"><span class="pre">SDL</span></tt> will choose the current/best color depth for the
display. The flags defaults to <tt class="docutils literal"><span class="pre">pygame.FULLSCREEN</span></tt>, but you may need to
add additional flags for specific fullscreen modes.</p>
</dd></dl>

<dl class="definition function">
<dt class="title" id="pygame.display.mode_ok">
<tt class="descclassname">pygame.display.</tt><tt class="descname">mode_ok</tt><big>(</big><big>)</big><a class="headerlink" href="#pygame.display.mode_ok" title="Permalink to this definition"></a></dt>
<dd><div class="line-block">
<div class="line"><span class="summaryline">pick the best color depth for a display mode</span></div>
<div class="line"><span class="signature">mode_ok(size, flags=0, depth=0) -&gt; depth</span></div>
</div>
<p>This function uses the same arguments as <tt class="docutils literal"><span class="pre">pygame.display.set_mode()</span></tt>. It
is used to depermine if a requested display mode is available. It will
return 0 if the display mode cannot be set. Otherwise it will return a pixel
depth that best matches the display asked for.</p>
<p>Usually the depth argument is not passed, but some platforms can support
multiple display depths. If passed it will hint to which depth is a better
match.</p>
<p>The most useful flags to pass will be <tt class="docutils literal"><span class="pre">pygame.HWSURFACE</span></tt>,
<tt class="docutils literal"><span class="pre">pygame.DOUBLEBUF</span></tt>, and maybe <tt class="docutils literal"><span class="pre">pygame.FULLSCREEN</span></tt>. The function will
return 0 if these display flags cannot be set.</p>
</dd></dl>

<dl class="definition function">
<dt class="title" id="pygame.display.gl_get_attribute">
<tt class="descclassname">pygame.display.</tt><tt class="descname">gl_get_attribute</tt><big>(</big><big>)</big><a class="headerlink" href="#pygame.display.gl_get_attribute" title="Permalink to this definition"></a></dt>
<dd><div class="line-block">
<div class="line"><span class="summaryline">get the value for an opengl flag for the current display</span></div>
<div class="line"><span class="signature">gl_get_attribute(flag) -&gt; value</span></div>
</div>
<p>After calling <tt class="docutils literal"><span class="pre">pygame.display.set_mode()</span></tt> with the <tt class="docutils literal"><span class="pre">pygame.OPENGL</span></tt> flag,
it is a good idea to check the value of any requested OpenGL attributes. See
<tt class="docutils literal"><span class="pre">pygame.display.gl_set_attribute()</span></tt> for a list of valid flags.</p>
</dd></dl>

<dl class="definition function">
<dt class="title" id="pygame.display.gl_set_attribute">
<tt class="descclassname">pygame.display.</tt><tt class="descname">gl_set_attribute</tt><big>(</big><big>)</big><a class="headerlink" href="#pygame.display.gl_set_attribute" title="Permalink to this definition"></a></dt>
<dd><div class="line-block">
<div class="line"><span class="summaryline">request an opengl display attribute for the display mode</span></div>
<div class="line"><span class="signature">gl_set_attribute(flag, value) -&gt; None</span></div>
</div>
<p>When calling <tt class="docutils literal"><span class="pre">pygame.display.set_mode()</span></tt> with the <tt class="docutils literal"><span class="pre">pygame.OPENGL</span></tt> flag,
Pygame automatically handles setting the OpenGL attributes like color and
doublebuffering. OpenGL offers several other attributes you may want control
over. Pass one of these attributes as the flag, and its appropriate value.
This must be called before <tt class="docutils literal"><span class="pre">pygame.display.set_mode()</span></tt></p>
<p>The <tt class="docutils literal"><span class="pre">OPENGL</span></tt> flags are;</p>
<div class="highlight-python"><div class="highlight"><pre><span class="n">GL_ALPHA_SIZE</span><span class="p">,</span> <span class="n">GL_DEPTH_SIZE</span><span class="p">,</span> <span class="n">GL_STENCIL_SIZE</span><span class="p">,</span> <span class="n">GL_ACCUM_RED_SIZE</span><span class="p">,</span>
<span class="n">GL_ACCUM_GREEN_SIZE</span><span class="p">,</span>  <span class="n">GL_ACCUM_BLUE_SIZE</span><span class="p">,</span> <span class="n">GL_ACCUM_ALPHA_SIZE</span><span class="p">,</span>
<span class="n">GL_MULTISAMPLEBUFFERS</span><span class="p">,</span> <span class="n">GL_MULTISAMPLESAMPLES</span><span class="p">,</span> <span class="n">GL_STEREO</span>
</pre></div>
</div>
</dd></dl>

<dl class="definition function">
<dt class="title" id="pygame.display.get_active">
<tt class="descclassname">pygame.display.</tt><tt class="descname">get_active</tt><big>(</big><big>)</big><a class="headerlink" href="#pygame.display.get_active" title="Permalink to this definition"></a></dt>
<dd><div class="line-block">
<div class="line"><span class="summaryline">true when the display is active on the display</span></div>
<div class="line"><span class="signature">get_active() -&gt; bool</span></div>
</div>
<p>After <tt class="docutils literal"><span class="pre">pygame.display.set_mode()</span></tt> is called the display Surface will be
visible on the screen. Most windowed displays can be hidden by the user. If
the display Surface is hidden or iconified this will return False.</p>
</dd></dl>

<dl class="definition function">
<dt class="title" id="pygame.display.iconify">
<tt class="descclassname">pygame.display.</tt><tt class="descname">iconify</tt><big>(</big><big>)</big><a class="headerlink" href="#pygame.display.iconify" title="Permalink to this definition"></a></dt>
<dd><div class="line-block">
<div class="line"><span class="summaryline">iconify the display surface</span></div>
<div class="line"><span class="signature">iconify() -&gt; bool</span></div>
</div>
<p>Request the window for the display surface be iconified or hidden. Not all
systems and displays support an iconified display. The function will return
True if successfull.</p>
<p>When the display is iconified <tt class="docutils literal"><span class="pre">pygame.display.get_active()</span></tt> will return
False. The event queue should receive a <tt class="docutils literal"><span class="pre">ACTIVEEVENT</span></tt> event when the
window has been iconified.</p>
</dd></dl>

<dl class="definition function">
<dt class="title" id="pygame.display.toggle_fullscreen">
<tt class="descclassname">pygame.display.</tt><tt class="descname">toggle_fullscreen</tt><big>(</big><big>)</big><a class="headerlink" href="#pygame.display.toggle_fullscreen" title="Permalink to this definition"></a></dt>
<dd><div class="line-block">
<div class="line"><span class="summaryline">switch between fullscreen and windowed displays</span></div>
<div class="line"><span class="signature">toggle_fullscreen() -&gt; bool</span></div>
</div>
<p>Switches the display window between windowed and fullscreen modes. This
function only works under the unix x11 video driver. For most situations it
is better to call <tt class="docutils literal"><span class="pre">pygame.display.set_mode()</span></tt> with new display flags.</p>
</dd></dl>

<dl class="definition function">
<dt class="title" id="pygame.display.set_gamma">
<tt class="descclassname">pygame.display.</tt><tt class="descname">set_gamma</tt><big>(</big><big>)</big><a class="headerlink" href="#pygame.display.set_gamma" title="Permalink to this definition"></a></dt>
<dd><div class="line-block">
<div class="line"><span class="summaryline">change the hardware gamma ramps</span></div>
<div class="line"><span class="signature">set_gamma(red, green=None, blue=None) -&gt; bool</span></div>
</div>
<p>Set the red, green, and blue gamma values on the display hardware. If the
green and blue arguments are not passed, they will both be the same as red.
Not all systems and hardware support gamma ramps, if the function succeeds
it will return True.</p>
<p>A gamma value of 1.0 creates a linear color table. Lower values will darken
the display and higher values will brighten.</p>
</dd></dl>

<dl class="definition function">
<dt class="title" id="pygame.display.set_gamma_ramp">
<tt class="descclassname">pygame.display.</tt><tt class="descname">set_gamma_ramp</tt><big>(</big><big>)</big><a class="headerlink" href="#pygame.display.set_gamma_ramp" title="Permalink to this definition"></a></dt>
<dd><div class="line-block">
<div class="line"><span class="summaryline">change the hardware gamma ramps with a custom lookup</span></div>
<div class="line"><span class="signature">set_gamma_ramp(red, green, blue) -&gt; bool</span></div>
</div>
<p>Set the red, green, and blue gamma ramps with an explicit lookup table. Each
argument should be sequence of 256 integers. The integers should range
between 0 and 0xffff. Not all systems and hardware support gamma ramps, if
the function succeeds it will return True.</p>
</dd></dl>

<dl class="definition function">
<dt class="title" id="pygame.display.set_icon">
<tt class="descclassname">pygame.display.</tt><tt class="descname">set_icon</tt><big>(</big><big>)</big><a class="headerlink" href="#pygame.display.set_icon" title="Permalink to this definition"></a></dt>
<dd><div class="line-block">
<div class="line"><span class="summaryline">change the system image for the display window</span></div>
<div class="line"><span class="signature">set_icon(Surface) -&gt; None</span></div>
</div>
<p>Sets the runtime icon the system will use to represent the display window.
All windows default to a simple pygame logo for the window icon.</p>
<p>You can pass any surface, but most systems want a smaller image around
32x32. The image can have colorkey transparency which will be passed to the
system.</p>
<p>Some systems do not allow the window icon to change after it has been shown.
This function can be called before <tt class="docutils literal"><span class="pre">pygame.display.set_mode()</span></tt> to create
the icon before the display mode is set.</p>
</dd></dl>

<dl class="definition function">
<dt class="title" id="pygame.display.set_caption">
<tt class="descclassname">pygame.display.</tt><tt class="descname">set_caption</tt><big>(</big><big>)</big><a class="headerlink" href="#pygame.display.set_caption" title="Permalink to this definition"></a></dt>
<dd><div class="line-block">
<div class="line"><span class="summaryline">set the current window caption</span></div>
<div class="line"><span class="signature">set_caption(title, icontitle=None) -&gt; None</span></div>
</div>
<p>If the display has a window title, this function will change the name on the
window. Some systems support an alternate shorter title to be used for
minimized displays.</p>
</dd></dl>

<dl class="definition function">
<dt class="title" id="pygame.display.get_caption">
<tt class="descclassname">pygame.display.</tt><tt class="descname">get_caption</tt><big>(</big><big>)</big><a class="headerlink" href="#pygame.display.get_caption" title="Permalink to this definition"></a></dt>
<dd><div class="line-block">
<div class="line"><span class="summaryline">get the current window caption</span></div>
<div class="line"><span class="signature">get_caption() -&gt; (title, icontitle)</span></div>
</div>
<p>Returns the title and icontitle for the display Surface. These will often be
the same value.</p>
</dd></dl>

<dl class="definition function">
<dt class="title" id="pygame.display.set_palette">
<tt class="descclassname">pygame.display.</tt><tt class="descname">set_palette</tt><big>(</big><big>)</big><a class="headerlink" href="#pygame.display.set_palette" title="Permalink to this definition"></a></dt>
<dd><div class="line-block">
<div class="line"><span class="summaryline">set the display color palette for indexed displays</span></div>
<div class="line"><span class="signature">set_palette(palette=None) -&gt; None</span></div>
</div>
<p>This will change the video display color palette for 8bit displays. This
does not change the palette for the actual display Surface, only the palette
that is used to display the Surface. If no palette argument is passed, the
system default palette will be restored. The palette is a sequence of
<tt class="docutils literal"><span class="pre">RGB</span></tt> triplets.</p>
</dd></dl>

</dd></dl>

</div>

  </div>
          </div>
      </div>
      <div class="clearer"></div>
    </div>
    <div class="related">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../genindex.html" title="General Index"
             accesskey="I">index</a></li>
        <li class="right" >
          <a href="draw.html" title="pygame.draw"
             accesskey="N">next</a> |</li>
        <li class="right" >
          <a href="cursors.html" title="pygame.cursors"
             accesskey="P">previous</a> |</li>
        <li><a href="../index.html">Pygame v1.9.2 documentation</a> &raquo;</li>
    <script type="text/javascript" src="jquery.plugin.docscomments.js"></script>

      </ul>
    </div>
    <div class="footer">
        &copy; Copyright 2011, Pygame Developers.
    </div>
  </body>
</html>
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.