help="save the image rendered to a png file") def onArgvParsed(self, options, args, parser): if len(args) != 2: parser.print_help() sys.exit(1) self._svgFName = args[0] self._svgID = args[1] self._size = options.size self._saveImage = options.saveImage def onInit(self): self.svg = avg.SVG(self._svgFName, True) img = self.svg.createImageNode(self._svgID, { "pos": (1, 1), "parent": self }, self._size) rect = avg.RectNode(fillcolor="808080", color="FFFFFF", fillopacity=1, pos=(0.5, 0.5), size=img.size + (1, 1)) self.insertChild(rect, 0) if self._saveImage: bmp = self.svg.renderElement(self._svgID, self._size) bmp.save(self._svgID + ".png") if __name__ == "__main__": app.App().run(ShowSVG(), app_resolution="1024x768")
def onRefresh(self, data): self.remote.refresh() pass def onSetVolume(self, data): self.remote.volume = float(data) pass def onRendererCrash(self, reason): print("renderer was terminated:" + reason) pass def onPluginCrash(self, pluginpath): print("plugin " + pluginpath + " crashed") pass def onLoadEnd(self): print("Load finished") pass def onExit(self): libavg_cefplugin.CEFnode.cleanup() pass def onFrame(self): pass #print player.pluginPath; app.App().run(MyMainDiv(), app_resolution='1024x600')
nodeList.append( gestures.TransformNode(text="TransformRecognizer", ignoreRotation=False, ignoreScale=False, pos=(380, 20), parent=self)) self.abortButton = AbortButton(text="Abort all", pos=(630, 490), parent=self) self.enableButton = EnableButton(text="Disable all", pos=(630, 540), parent=self) app.keyboardmanager.bindKeyDown(keystring="a", handler=abortAll, help="abort recognition") app.keyboardmanager.bindKeyDown(keystring="d", handler=self.onEnableKey, help="Enable/disable recognition") def onEnableKey(self): switchNodesEnabled() self.enableButton.changeText() if __name__ == '__main__': app.App().run(GestureDemoDiv(), app_resolution="800,600")
app.keyboardmanager.bindKeyDown(keystring="1", handler=lambda: addWhitebalance(du=-1), help="Decrease whitebalance u") app.keyboardmanager.bindKeyDown(keystring="2", handler=lambda: addWhitebalance(du=1), help="Increase whitebalance u") app.keyboardmanager.bindKeyDown(keystring="3", handler=lambda: addWhitebalance(dv=-1), help="Decrease whitebalance v") app.keyboardmanager.bindKeyDown(keystring="4", handler=lambda: addWhitebalance(dv=1), help="Increase whitebalance v") app.keyboardmanager.bindKeyDown(keystring="left", handler=lambda: addShutter(shutter=-1), help="Decrease shutter") app.keyboardmanager.bindKeyDown(keystring="right", handler=lambda: addShutter(shutter=1), help="Increase shutter") app.keyboardmanager.bindKeyDown(keystring="up", handler=lambda: addGain(gain=1), help="Increase gain") app.keyboardmanager.bindKeyDown(keystring="down", handler=lambda: addGain(gain=-1), help="Decrease gain") if __name__ == "__main__": app.App().run(ShowCamera())
fillopacity=1, fillcolor="E03030", parent=self) polygonPos3 = [libavg.Point2D(120, 0) + pt for pt in polygonPos1] libavg.PolygonNode(pos=polygonPos3, strokewidth=5, linejoin="bevel", parent=self) polygonPos4 = [libavg.Point2D(180, 0) + pt for pt in polygonPos1] libavg.PolygonNode(pos=polygonPos4, strokewidth=5, linejoin="miter", parent=self) geom.Arc(pos=(20, 100), radius=15, startangle=0, endangle=3.1415, parent=self) geom.PieSlice(pos=(60, 100), radius=15, startangle=0, endangle=1, parent=self) geom.RoundedRect(pos=(85, 85), size=(30, 30), radius=5, parent=self) app.App().run(VectorDiv())
self._colCbox.subscribe(widget.CheckBox.TOGGLED, self._onCheckBoxCol) def _onSliderHue(self, value): self._fx.hue = int(value) self._hueTxt.text = 'hue: %d' % self._fx.hue def _onSliderSat(self, value): self._fx.saturation = int(value) self._satTxt.text = 'saturation: %d' % self._fx.saturation def _onSliderLight(self, value): self._fx.lightness = int(value) self._lightTxt.text = 'lightness: %d' % self._fx.lightness def _onCheckBoxCol(self, checked): self._fx.colorize = checked if checked: self._hueSld.range = (0, 360) self._satSld.range = (0, 100) else: self._hueSld.range = (-180, 180) self._satSld.range = (-100, 100) self._hueSld.thumbPos = self._fx.hue self._satSld.thumbPos = self._fx.saturation self._onSliderHue(self._hueSld.thumbPos) self._onSliderSat(self._satSld.thumbPos) if __name__ == '__main__': app.App().run(HueSatFx(), app_resolution='200x200')
texcoord1=texcoord1, texcoord2=texcoord2, parent=div) def onExit(self): pass def onFrame(self): if self.growLine: self.lineLen += 1 if self.lineLen > 300: self.growLine = False else: self.lineLen -= 1 if self.lineLen < 100: self.growLine = True self.__calcPolyLine() def __calcPolyLine(self): pos = [] texcoords = [] for i in xrange(20): xpos = (10.0 * i) / 100 * self.lineLen pos.append((xpos, 130 + 10 * math.sin(i * 2))) texcoords.append(xpos / 10) self.polyLine.pos = pos self.polyLine.texcoords = texcoords app.App().run(LinesDiv())
# # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # # Current versions can be found at www.libavg.de from libavg import avg, app class VSyncDiv(app.MainDiv): def onInit(self): self.__line = avg.LineNode(color='FFFFFF', parent=self) self.__x = 0 def onFrame(self): self.__x += 1 if self.__x == self.width: self.__x = 0 self.__line.pos1 = (self.__x, 0) self.__line.pos2 = (self.__x, self.height) if __name__ == '__main__': app.App().run(VSyncDiv(), app_resolution='800x600')
l = len(self.__imgFiles) avg.logger.info('%d image file%s found' % (l, 's' if l > 1 else '')) shuffle(self.__imgFiles) self.__slidesDiv = avg.DivNode(size=self.size, parent=self) # ping-pong two slides for cross-fade transition self.__newSlide = Slide(parent=self.__slidesDiv) self.__oldSlide = Slide(href=self.__imgFiles[0], parent=self.__slidesDiv) # HIDE_DONE notifications will trigger asynchronous pre-loading of the next image self.__newSlide.subscribe(Slide.HIDE_DONE, self.__asyncPreload) self.__oldSlide.subscribe(Slide.HIDE_DONE, self.__asyncPreload) self.__currentIdx = 0 self.__changeSlide() player.setInterval(CHANGE_INTERVAL, self.__changeSlide) def __asyncPreload(self, slide): self.__currentIdx = (self.__currentIdx + 1) % len(self.__imgFiles) BitmapMgr.loadBitmap(self.__imgFiles[self.__currentIdx], slide.setBitmap) def __changeSlide(self): self.__oldSlide, self.__newSlide = self.__newSlide, self.__oldSlide self.__slidesDiv.reorderChild(self.__newSlide, 1) # move to top self.__newSlide.show() self.__oldSlide.hide() if __name__ == '__main__': app.App().run(Slideshow())
#!/usr/bin/env python from libavg import app, avg from random import randint, random class MainDiv(app.MainDiv): def onInit(self): self.poly = avg.PolygonNode(pos=self.__genPts(), fillopacity=0.5, parent=self) def onFrame(self): self.poly.pos = self.__genPts() def __genPts(self): def randPos(): return avg.Point2D(randint(0, 1400), randint(0, 800)) basePts = [randPos() for i in range(10)] pts = [] for i in range(1000): basePt = basePts[randint(0, 9)] pts.append(basePt + (random(), random())) return pts app.App().run(MainDiv(), app_resolution='1400, 800')
if not (self.isPaused): self.node.play() self.isSeeking = False def onSeek(self, time): self.node.seekToTime(int(time)) def __makeAlphaBackground(self): SQUARESIZE = 40 size = self.node.getMediaSize() avg.RectNode(parent=self, size=self.node.getMediaSize(), strokewidth=0, fillcolor="FFFFFF", fillopacity=1) for y in xrange(0, int(size.y) / SQUARESIZE): for x in xrange(0, int(size.x) / (SQUARESIZE * 2)): pos = avg.Point2D(x * SQUARESIZE * 2, y * SQUARESIZE) if y % 2 == 1: pos += (SQUARESIZE, 0) avg.RectNode(parent=self, pos=pos, size=(SQUARESIZE, SQUARESIZE), strokewidth=0, fillcolor="C0C0C0", fillopacity=1) if __name__ == "__main__": app.App().run(VideoPlayer())
class CaptionNode(avg.WordsNode): def __init__(self, pos, text, parent): pos = avg.Point2D(pos) + (32,70) super(CaptionNode, self).__init__(pos=pos, text=text, alignment="center", fontsize=11, aagamma=2.0, width=64) self.registerInstance(self, parent) class RenderingDiv(app.MainDiv): def onInit(self): self.toggleTouchVisualization() avg.WordsNode(pos=(10,5), text="Masking", fontsize=13, aagamma=2.0, parent=self) avg.ImageNode(pos=(10,30), href="rgb24-64x64.png", parent=self) CaptionNode(pos=(10,30), text="Plain Image", parent=self) avg.ImageNode(pos=(90,30), href="rgb24-64x64.png", maskhref="mask.png", parent=self) CaptionNode(pos=(90,30), text="Masked Image", parent=self) avg.WordsNode(pos=(10,155), text="Blend Modes", fontsize=13, aagamma=2.0, parent=self) for i, blendmode in enumerate(("blend", "add", "min", "max")): pos=avg.Point2D(10,180)+i*avg.Point2D(80,0) avg.ImageNode(pos=pos, href="mask.png", parent=self) avg.ImageNode(pos=pos, href="rgb24-64x64.png", blendmode=blendmode, parent=self) CaptionNode(pos=pos, text=blendmode, parent=self) app.App().run(RenderingDiv(), app_resolution='400x300')
self.__vis_params.shift_time(False) def shift_forward(self): self.__vis_params.shift_time(True) def play_pause(self): self.__vis_params.is_playing = not self.__vis_params.is_playing def toggle_floor_view(self): self.user_floor_panel.active = not self.user_floor_panel.active self.device_floor_panel.active = not self.device_floor_panel.active def toggle_user_visible(self, userid): is_visible = self.__vis_params.get_user_visible(userid) self.__vis_params.set_user_visible(userid, not is_visible) def toggle_heat_maps(self): self.user_floor_panel.use_heatmap = not self.user_floor_panel.use_heatmap self.device_floor_panel.use_heatmap = not self.device_floor_panel.use_heatmap def value_to_pixel(value, max_px, interval): a = (interval[1] - interval[0]) / max_px return (value - interval[0]) / a player.setWindowTitle("GIAnT - Session {}".format(SESSION_ID)) app.App().run(MainDiv(), app_resolution="2880x1000", app_window_size="1920x666")
12.0, 13.0, 14.0, 15.0, 16.0 ], [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0 ], [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0 ]] cm = [ "040ED8", "2050FF", "4196FF", "6DC1FF", "86D9FF", "9CEEFF", "AFF5FF", "CEFFFF", "FFFE47", "FFEB00", "FFC400", "FF9000", "FF4800", "FF0000", "D50000", "9E0000" ] heatmap_node = HeatMapNode(id="test", size=self.size, parent=self, colormap=cm, valuerangemin=1, valuerangemax=16, overlay_src="world.png") heatmap_node.set_data(matrix) resolution = avg.Point2D(1920, 1080) resolutionStr = str(resolution.x) + ", " + str(resolution.y) app.App().run(HeatMapDiv(), app_resolution=resolutionStr)
parent=self) self.words.pos = (self.size - (0, self.words.size.y)) / 2 def getSize(self): return self.__divSize def setSize(self, size): self.rect.size = size self.words.pos = (size - (0, self.words.size.y)) / 2 self.__divSize = size __divSize = avg.DivNode.size size = property(getSize, setSize) class SubclassDemo(app.MainDiv): def onInit(self): self.rect = TextRect(text="Hello World", pos=(20, 20), size=(200, 120), parent=self) self.__recognizer = gesture.TapRecognizer(node=self.rect, detectedHandler=self.onTap) def onTap(self): self.rect.size = self.rect.size + (10, 10) if __name__ == '__main__': app.App().run(SubclassDemo(), app_resolution='800x600')
if isinstance(bmp, Exception): self.__infoNode.text = ('Error loading ' 'image %s : %s' % (self.__pics[self.__currentPic], str(bmp))) self.__imageNode.href = '' else: self.__infoNode.text = ('Loaded %s, ' 'press space for the next one' % self.__pics[self.__currentPic]) self.__setBitmapAndResize(bmp) def __setBitmapAndResize(self, bmp): originalSize = bmp.getSize() if originalSize.x > originalSize.y: ratio = (APP_RESOLUTION[0] - 20) / originalSize.x else: ratio = (APP_RESOLUTION[1] - 40) / originalSize.y self.__imageNode.setBitmap(bmp) self.__imageNode.size = originalSize * ratio def __onFrame(self): if self.__spinner.active: self.__spinner.angle += 0.05 if len(sys.argv) == 1: print 'Usage: %s <filename> [<filename> [<filename> [..]]]' % sys.argv[0] sys.exit(1) app.App().run(AsyncLoadDiv(), app_resolution="640,480")
forecasts = location.forecast station = location.condition.text today = str(now) windSpeed = location.wind.speed windDir = location.wind.direction currTemp = location.condition.temp currPress = location.atmosphere['pressure'] imageCode = location.condition.code forecastCounter = 0 forecasts = location.forecast for forecast in forecasts: forecastCounter += 1 forecastText[forecastCounter] = forecast.text[:14] forecastDays[forecastCounter] = forecast.day forecastHighs[forecastCounter] = forecast.high forecastLows[forecastCounter] = forecast.low print(forecastText) print(today) retrieval() app.App().run(Weather()) print("after Play") #while True: # app.App().run(Weather()) # time.sleep(60.0 - ((time.time() - starttime) % 60.0))
# # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # # Current versions can be found at www.libavg.de from libavg import app, player class DumpKeyEvents(app.MainDiv): def onInit(self): player.subscribe(player.KEY_DOWN, self.onKeyDown) player.subscribe(player.KEY_UP, self.onKeyUp) def onKeyDown(self, event): self.__showMsg("KEY_DOWN", event) def onKeyUp(self, event): self.__showMsg("KEY_UP", event) def __showMsg(self, title, event): msg = (title + ": name='" + event.keyname + "', text='" + event.text + "', scancode=" + str(event.scancode)) app.flashmessage.FlashMessage(msg) print msg if __name__ == '__main__': app.App().run(DumpKeyEvents(), app_resolution='800x600')
enemiesActive = True if e.alive: for b in bullets: if self.__bulletCollisionDetector.detect(e.pos, b.pos): self.__scoreCounter.inc() e.destroy() b.destroy() break if e.alive: # no bullet hit if (self.__player.alive and self.__playerCollisionDetector.detect( e.pos, self.__player.pos)): e.destroy() if self.__lifeCounter.dec(): player.clearInterval(self.__spawnTimeoutId) self.__spawnTimeoutId = None self.__player.destroy() if e.alive: # no player collision e.update(dt) if self.__player.alive: self.__player.update(dt, self.__keyStates) elif not self.__player.updateBullets(dt) and not enemiesActive: # player dead, all bullets and enemies left the screen, all destroy videos # played self.__stop() if __name__ == '__main__': app.App().run(FireBirds(), app_resolution='1280x720')
href=fileName, opacity=0, loop=True, parent=self) videoNode.play() self.videoNodes.append(videoNode) self.videoNodes[0].opacity = 1 self.runningVideo = 0 self.isFading = False app.keyboardmanager.bindKeyDown(keyname='1', handler=self.onButtonPressed, help='Crossfade between videos') def onButtonPressed(self): if not (self.isFading): if self.runningVideo == 0: avg.Anim.fadeIn(self.videoNodes[1], self.__duration) else: avg.Anim.fadeOut(self.videoNodes[1], self.__duration) player.setTimeout(self.__duration, self.fadeEnd) self.runningVideo = (self.runningVideo + 1) % 2 self.isFading = True def fadeEnd(self): self.isFading = False app.App().run(HDVideo(), app_resolution='1680x1050', app_window_size='720x450')
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # # Current versions can be found at www.libavg.de import sys from libavg import avg, app, player class AudioPlayerDiv(app.MainDiv): def onArgvParserCreated(self, parser): parser.set_usage("%prog <filename>") def onArgvParsed(self, options, args, parser): if len(args) != 1: parser.print_help() sys.exit(1) self._audioFName = args[0] def onInit(self): self._node = avg.SoundNode(parent=self, href=self._audioFName) self._node.play() self._words = avg.WordsNode(parent=self, pos=(10, 22), fontsize=10) def onFrame(self): curTime = self._node.getCurTime() self._words.text = "Time: " + str(curTime / 1000.0) if __name__ == "__main__": app.App().run(AudioPlayerDiv(), app_resolution="320x200")
print fontList print print self._usage print ' Option -h or --help gives a full help.' exit() self._fontname = args[0] if len(args) > 1: self._displayText = args[1] else: self._displayText = None def onInit(self): variants = avg.WordsNode.getFontVariants(self._fontname) print variants y = 10 for variant in variants: if self._displayText: text = self._displayText else: text = self._fontname + ": " + variant avg.WordsNode(text=text, font=self._fontname, variant=variant, fontsize=24, pos=(10, y), parent=self) y += 50 if __name__ == '__main__': app.App().run(ShowFont())
def chooseVideo(self, event, videoNode): if self.bigVideoNode: self.removeBigVideo() destSize = videoNode.size * 2 destPos = Point2D(720, 550) - destSize / 2 absPos = videoNode.getAbsPos(Point2D(0, 0)) frame = videoNode.getCurFrame() self.bigVideoNode = avg.VideoNode(href=videoNode.href, loop=True, sensitive=False, parent=self) self.bigVideoNode.play() self.bigVideoNode.seekToFrame(frame) avg.EaseInOutAnim(self.bigVideoNode, "pos", 1000, absPos, destPos, False, 300, 300).start() avg.EaseInOutAnim(self.bigVideoNode, "size", 1000, videoNode.size, destSize, False, 300, 300).start() def removeBigVideo(self): oldVideoNode = self.bigVideoNode avg.fadeOut(oldVideoNode, self.__duration, lambda: oldVideoNode.unlink(True)) def getTotalWidth(self): return (self.__thumbWidth + 20) * len(self.videoNodes) app.App().run(VideoChooser(), app_resolution='1440x900', app_window_size='720x450')
print "Camera:" print " device=", self.__camNode.device print " shutter=", self.__camNode.shutter print " gain=", self.__camNode.gain print " White Balance: (u=", self.__camNode.getWhitebalanceU(), ", v=", \ self.__camNode.getWhitebalanceV() print "Chromakey:" print " color=", self.__filter.color print " htolerance=", self.__filter.htolerance print " stolerance=", self.__filter.stolerance print " ltolerance=", self.__filter.ltolerance print " softness=", self.__filter.softness print " erosion=", self.__filter.erosion print " spillthreshold=", self.__filter.spillthreshold usage = """%prog [options] avg_chromakey.py is a configuration utility for the libavg chromakey filter. The chromakey filter allows implementation of green- or bluescreens with libavg. This utility shows a camera image with chromakey applied to it and allows the user to adjust the camera and filter parameters. The parameters can be dumped to the console for easy inclusion in libavg scripts. """ if __name__ == "__main__": app.App().run(Chromakey())
avg.logger.configureCategory(avg.logger.Category.APP, avg.logger.Severity.INFO) avg.logger.log("Custom Info level message", avg.logger.Category.APP, avg.logger.Severity.INFO) avg.logger.info("Info level message, with APP Category") avg.logger.warning("Warn level message, with APP Category") #Remove the logSink, no message should be logged now, if run with #AVG_LOG_OMIT_STDERR=1 #avg.logger.removeSink(logging.getLogger("MY_APP")) avg.logger.error("std::err - Error") avg.logger.critical("std::err - Critical") avg.logger.log("std::err - Log") #Register custom log category CUSTOM_LOG_CAT = avg.logger.configureCategory("My Custom Category", avg.logger.Severity.INFO) #Log with custom log category avg.logger.log("Message with custom category", CUSTOM_LOG_CAT) avg.logger.debug("Hidden message", CUSTOM_LOG_CAT) avg.logger.configureCategory(CUSTOM_LOG_CAT, avg.logger.Severity.DBG) avg.logger.debug("This will show up", CUSTOM_LOG_CAT) if __name__ == '__main__': app.App().run(LoggingTest(), app_resolution='140x140')
# This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # # Current versions can be found at www.libavg.de from libavg import avg, app class Invert(app.MainDiv): def onInit(self): orig = avg.ImageNode(parent=self, href='../test/media/hsl.png') invert = avg.ImageNode(parent=self, href='../test/media/hsl.png', pos=(orig.size.x + 10, 0)) invert.setEffect(avg.InvertFXNode()) if __name__ == '__main__': app.App().run(Invert(), app_resolution='200x200')
#!/usr/bin/env python # -*- coding: utf-8 -*- from libavg import app class MyMainDiv(app.MainDiv): def onInit(self): self.toggleTouchVisualization() def onExit(self): pass def onFrame(self): pass app.App().run(MyMainDiv())
self.__rawContactCircle.opacity = 1 self.__filteredContactCircle.opacity = 1 self.__filters = [ filter.OneEuroFilter(self.__minCutoff, self.__cutoffSlope), filter.OneEuroFilter(self.__minCutoff, self.__cutoffSlope) ] self.__onFrame = player.subscribe(player.ON_FRAME, self.__moveContact) def __onUp(self, event): self.__rawContactCircle.opacity = 0 self.__filteredContactCircle.opacity = 0 self.__contact = None self.__filters = None player.unsubscribe(self.__onFrame) def __moveContact(self): time = player.getFrameTime() rawPos = self.__contact.events[-1].pos self.__rawContactCircle.pos = rawPos filteredPos = avg.Point2D(self.__filters[0].apply(rawPos.x, time), self.__filters[1].apply(rawPos.y, time)) self.__filteredContactCircle.pos = filteredPos if __name__ == "__main__": app.App().run(JitterFilter(), app_resolution="800x600", app_show_cursor="true", multitouch_enabled="true")
# This message is displayed immediately app.flashmessage.FlashMessage( 'helloworld! this message will disappear in a bit') # Displayed when the 'v' key is pressed, again a simple flash message app.keyboardmanager.bindKeyDown( 'v', lambda: app.flashmessage.FlashMessage('v key pressed'), 'Test me') # This message shows the message in a different color and sends the text to # the logger as well app.keyboardmanager.bindKeyDown( 'b', lambda: app.flashmessage.FlashMessage('this is an error', isError=True), 'Test me too') # This message disappears when it's acknowledged with a mouse click app.keyboardmanager.bindKeyDown( 'n', lambda: app.flashmessage.FlashMessage( 'persistent, click here to dismiss', acknowledge=True), 'Test me too again') libavg.avg.WordsNode(parent=self, pos=(10, 50), fontsize=20, text='Press the keys: v, b, n') if __name__ == '__main__': app.App().run(MyScene())
imageWidthSlider.range = (100, 1024) imageWidthSlider.thumbPos = 1024 imageWidthSlider.subscribe(widget.ScrollBar.THUMB_POS_CHANGED, lambda thumbPos, scrollArea=scrollArea: self .setImageWidth(scrollArea, thumbPos)) imageHeightSlider = widget.Slider( pos=pos + (230, 0), height=220, orientation=widget.Orientation.VERTICAL, parent=self) imageHeightSlider.range = (100, 1024) imageHeightSlider.thumbPos = 1024 imageHeightSlider.subscribe(widget.ScrollBar.THUMB_POS_CHANGED, lambda thumbPos, scrollArea=scrollArea: self.setImageHeight(scrollArea, thumbPos)) self.controls.extend([scrollArea, imageWidthSlider, imageHeightSlider]) def onCheck(self, isChecked): for node in self.controls: node.enabled = not (isChecked) def __addValueDisplay(self, scrollBar, pos): textNode = avg.WordsNode(pos=pos, color="000000", parent=self) scrollBar.subscribe(widget.ScrollBar.THUMB_POS_CHANGED, lambda pos, node=textNode: self.setText(pos, node)) self.setText(scrollBar.thumbPos, textNode) app.App().run(SimpleUI(), app_resolution='1024x768')