def main(): global win clock.schedule(rabbyt.add_time) win = pyglet.window.Window(width=leaves.SCREEN_WIDTH, height=leaves.SCREEN_HEIGHT) window.set_window(win) rabbyt.set_default_attribs() garbage = GarbageCan() leafs = leaves.LeafGroup() leafs += [leaves.Leaf(), leaves.Leaf(), leaves.Leaf() ] for i in range(len(leafs)): leafs[i].logicalX = 260 + i*80 leafs[i].logicalY = 100 + i*60 leafs[i].logicalZ = 10 while not win.has_exit: tick = clock.tick() win.dispatch_events() leafs.update(tick) garbage.update(tick) events.ConsumeEventQueue() rabbyt.clear((1, 1, 1)) leafs.draw() garbage.draw() win.flip()
def main(): clock.schedule(rabbyt.add_time) win = pyglet.window.Window(width=800, height=600) window.set_window(win) rabbyt.set_default_attribs() grill = Grill() while not win.has_exit: tick = clock.tick() win.dispatch_events() grill.update(tick) rabbyt.clear((1, 1, 1)) grill.draw() win.flip()
def add_orchidee_as_index(orchidee, indexfile, varname): """copies an orchidee output to the indexfile. The file name "orchidee" must represent a rebuilt orchidee file. (meaning that there is one file representing the entire spatial domain for the year, as opposed to the raw orchidee output which is one file per processor per year.) "indexfile" must already exist and must be writeable.""" orc = nc.Dataset(orchidee) idx = nc.Dataset(indexfile, "a") window_var = orc.variables[varname] window_lons = orc.variables['lon'] window_lats = orc.variables['lat'] geog_box = [ np.min(window_lons), np.max(window_lons), np.min(window_lats), np.max(window_lats) ] ds_lats = idx.variables['nav_lat'][:, 0] ds_lons = idx.variables['nav_lon'][0, :] w = trend.Window(ds_lats, ds_lons, geog_box) ca = trend.CompressedAxes(idx, 'land') # create the output variable outvar = idx.createVariable(varname, window_var.dtype, ('days', 'land')) # copy data one day at a time for d in range(len(idx.dimensions['days'])): # get the data from the orchidee simulation day_data = window_var[d, ...] # pad the data so it's the same size as # the data in the index file. day_data = w.set_window(day_data) # compress it down to 1D vector compressed_day_data = ca.compress(day_data) # write it to file outvar[d, :] = compressed_day_data orc.close() idx.close()
def add_orchidee_as_index(orchidee, indexfile, varname) : """copies an orchidee output to the indexfile. The file name "orchidee" must represent a rebuilt orchidee file. (meaning that there is one file representing the entire spatial domain for the year, as opposed to the raw orchidee output which is one file per processor per year.) "indexfile" must already exist and must be writeable.""" orc = nc.Dataset(orchidee) idx = nc.Dataset(indexfile, "a") window_var = orc.variables[varname] window_lons = orc.variables['lon'] window_lats = orc.variables['lat'] geog_box = [ np.min(window_lons), np.max(window_lons), np.min(window_lats), np.max(window_lats) ] ds_lats = idx.variables['nav_lat'][:,0] ds_lons = idx.variables['nav_lon'][0,:] w = trend.Window(ds_lats, ds_lons, geog_box) ca = trend.CompressedAxes(idx, 'land') # create the output variable outvar = idx.createVariable(varname, window_var.dtype, ('days', 'land')) # copy data one day at a time for d in range(len(idx.dimensions['days'])) : # get the data from the orchidee simulation day_data = window_var[d,...] # pad the data so it's the same size as # the data in the index file. day_data = w.set_window(day_data) # compress it down to 1D vector compressed_day_data = ca.compress(day_data) # write it to file outvar[d,:] = compressed_day_data orc.close() idx.close()
exit(0) def restart_program(): python = sys.executable os.execl(python, python, *sys.argv) def show_info_label_for_add_window(text): label = set_label(add_window_bottom_field, text, 0, 0, '#c7d4d1') add_window.after(3000, label.destroy) # main main_window = window.set_window('CENNIK', 1100, 550, '#c6c3c0') icon = tk.PhotoImage(file='img/indeks.png') main_window.tk.call('wm', 'iconphoto', main_window._w, icon) main_window.protocol("WM_DELETE_WINDOW", close_app) top_field = tk.Frame(main_window) top_field.pack(side=tk.TOP, fill=tk.Y) top_field.configure(background='#c6c3c0') entry_and_button_field = tk.Frame(main_window) entry_and_button_field.pack(side=tk.TOP, fill=tk.Y) entry_and_button_field.configure(background='#c6c3c0') result_field = tk.Frame(main_window) result_field.pack(side=tk.TOP, fill=tk.Y)
def main(sound_on=True, show_fps=True): global game_window game_window = pyglet.window.Window(width=800, height=600) window.set_window(game_window) pyglet.clock.schedule(rabbyt.add_time) rabbyt.set_default_attribs() storyteller = narrative.StoryTeller() wind = leaves.Wind() leafGenerator = leaves.LeafGenerator() leafGroup = leaves.LeafGroup() bubbles.init() bubbles.win = game_window storyteller = narrative.StoryTeller() mowr = mower.Mower() guage = mower.Guage(mowr) dawg = dog.Dog() pooMaster = dog.PooMaster() floaterGenerator = glitches.FloaterGenerator() codeGenerator = glitches.SourcecodeGenerator() scene = sky.Background(mowr) game_title = title.Title() # frontload a big png blah_ = data.pngs["codesnip.png"] mini_grill = grass.MiniGrill() big_grill = grill.Grill() if show_fps: fps_display = pyglet.clock.ClockDisplay() if sound_on: soundtrack = sound.queue_soundtrack() soundtrack.play() while not game_window.has_exit: tick = pyglet.clock.tick() game_window.dispatch_events() if big_grill.active: big_grill.update(tick) scene.color = (0.2, 0.7, 0.2) else: scene.update(tick) leafGenerator.update(tick) leafGroup.update(tick) wind.update(tick) dawg.update(tick) pooMaster.update(tick) floaterGenerator.update(tick) codeGenerator.update(tick) bubbles.bubbleMaker.update(tick) mowr.update(tick) game_title.update(tick) if mini_grill.active: big_grill.active = True mini_grill.active = False rabbyt.clear((scene.color)) events.ConsumeEventQueue() if not big_grill.active: scene.draw() mini_grill.draw() mowr.draw() leafGroup.draw() pooMaster.draw() dawg.draw() floaterGenerator.draw() bubbles.bubbleMaker.draw() guage.draw() codeGenerator.draw() else: big_grill.draw() bubbles.bubbleMaker.draw() game_title.draw() if show_fps: fps_display.draw() game_window.flip()