Friday, January 10, 2014

Draw a pixel with PySDL2

This is a minimal code to output pixel on the screen using PySDL2.

UPD: (March 2014) Up for PySDL2 0.9.0 (RenderContext renamed to Renderer)
#!/usr/bin/env python
"""
The code is placed into public domain
by anatoly techtonik <techtonik@gmail.com>
"""
import sdl2
import sdl2.ext as lib

lib.init()

window = lib.Window('', size=(300, 100))
window.show()

renderer = lib.Renderer(window)
renderer.draw_point([10,10], lib.Color(255,255,255))
renderer.present()

running = True
while running:
  for e in lib.get_events():
    if e.type == sdl2.SDL_QUIT:
      running = False
      break
    if e.type == sdl2.SDL_KEYDOWN:
      if e.key.keysym.sym == sdl2.SDLK_ESCAPE:
        running = False
        break

2 comments:

  1. Consequently, when the first reel lands on the jackpot cease, the 메리트카지노 first stopper moves farther to the left than it would for any other stopper. If the second reel stops on the jackpot as properly, the second stopper also moves farther left. There are any variety of ways to rearrange these parts, and producers have tried dozens of approaches through the years, so we'll focus on to} one consultant design. The fundamental design includes three reels mounted on a central shaft. The central shaft also supports three notched discs, that are related to the three reels. A second shaft under the central shaft supports a kicker, a chunk of metal comprising three paddles.

    ReplyDelete
  2. Capital Sheet Metal remains 100% committed to our clients and has applied the following. Are you involved about how to choose on} and migrate to a greater CAD best socket organizer solution? Then read here how 2D designers, 3D modelers and BIM developers can be a part of the BricsCAD Lab. At Bricsys, we understand the day-to-day challenges faced by land surveyors, both out in the subject and again in the workplace. And to stay productive, a well-tested platform is essential for CAD-based land surveying.

    ReplyDelete