annotate sandbox/gl.py @ 251:9369dbad919d
Incompatible changes to Monomer interfaces.
This branch does not work!
- (!!) only changed allpy._monomer, not uses
- (!!) removed (temporarily) classes for specific monomer types (DNAMonomer, etc)
- refurbished allpy.data.AAcodes to allpy.data.codes with much cleaner
interface
- refurbished allpy._monomer for simplicity and more friendly interface
Now it will (someday) be possible to say:
a = Monomer.from_name("alanine")
b = protein.Monomer.from_code1("a")
c = protein.MonomerType.from_code3("ala")
d = dna.Monomer.from_code3("DA")
but impossible to say:
d = protein.Monomer.from_code3("DA")
author |
Daniil Alexeyevsky <me.dendik@gmail.com> |
date |
Mon, 13 Dec 2010 20:12:11 +0300 |
parents |
|
children |
61e5d8e146c7 |
rev |
line source |
dendik@13
|
1 #!/usr/bin/python |
dendik@13
|
2 # http://disruption.ca/gutil/example3/example3a.html |
dendik@13
|
3 # vim: set noet: |
dendik@13
|
4 |
dendik@13
|
5 import gutil |
dendik@13
|
6 import pygame |
dendik@13
|
7 from pygame.locals import * |
dendik@13
|
8 from OpenGL.GL import * |
dendik@13
|
9 |
dendik@13
|
10 from Image import Image |
dendik@13
|
11 |
dendik@13
|
12 |
dendik@13
|
13 def main(): |
dendik@13
|
14 pygame.init() |
dendik@13
|
15 gutil.initializeDisplay(800, 600) |
dendik@13
|
16 |
dendik@13
|
17 done = False |
dendik@13
|
18 |
dendik@13
|
19 cow = Image('cow') |
dendik@13
|
20 alien = Image('alien') |
dendik@13
|
21 |
dendik@13
|
22 white = (255,255,255,255) |
dendik@13
|
23 stringTex, w, h, tw, th = gutil.loadText("Cow!", color=white) |
dendik@13
|
24 stringDL = gutil.createTexDL(stringTex, tw, th) |
dendik@13
|
25 |
dendik@13
|
26 while not done: |
dendik@13
|
27 glClear(GL_COLOR_BUFFER_BIT) |
dendik@13
|
28 glLoadIdentity() |
dendik@13
|
29 glColor4f(1.0,1.0,1.0,1.0) |
dendik@13
|
30 glTranslatef(100, 400, 0) |
dendik@13
|
31 glCallList(stringDL) |
dendik@13
|
32 |
dendik@13
|
33 cow.draw(pos=(100,100),width=128,height=128) |
dendik@13
|
34 alien.draw(pos=(400, 400),rotation=-15,color=(.9,.3,.2,1)) |
dendik@13
|
35 |
dendik@13
|
36 |
dendik@13
|
37 pygame.display.flip() |
dendik@13
|
38 |
dendik@13
|
39 eventlist = pygame.event.get() |
dendik@13
|
40 for event in eventlist: |
dendik@13
|
41 if event.type == QUIT \ |
dendik@13
|
42 or event.type == KEYDOWN and event.key == K_ESCAPE: |
dendik@13
|
43 done = True |
dendik@13
|
44 |
dendik@13
|
45 if __name__ == '__main__': |
dendik@13
|
46 main() |