Python kivy.core.window.Window 模块,height() 实例源码

我们从Python开源项目中,提取了以下25个代码示例,用于说明如何使用kivy.core.window.Window.height()

项目:kivy_rpg    作者:spinningD20    | 项目源码 | 文件源码
def __init__(self, target, **kwargs):
        super(BattleMenuState, self).__init__(target, **kwargs)
        print('battle menu state here, how ya doin', self, target)
        overlay = App.get_running_app().overlay
        self.move_button = Button(text='Move', on_release=lambda dt: self.change(SelectMoveState))
        self.attack_button = Button(text='Attack', on_release=lambda dt: self.change(SelectAttackState))
        self.wait_button = Button(text='Wait', on_release=lambda dt: self.change(TurnEnd))
        menu = GridLayout(cols=1, size_hint=(None, None), row_force_default=True, row_default_height=40)
        menu.width = dp(100)
        menu.height = menu.minimum_height
        buttons = [self.move_button, self.attack_button, self.wait_button]
        for button in buttons:
            menu.add_widget(button)
        menu.y = dp((Window.height / 2) + (menu.height / 2))
        menu.x = dp(40)
        self.menu = menu
        overlay.add_widget(self.menu)
        self.target.game.set_focus_target(self.target)
项目:zipper    作者:richarddun    | 项目源码 | 文件源码
def __init__(self,**kwargs):
        self.baseimg = os.path.abspath(os.path.join(os.path.dirname('__file__'),'animation','effects','enbar_noback.png'))
        self.hpimg = os.path.abspath(os.path.join(os.path.dirname('__file__'),'animation','effects','hbar.png'))
        self.mpimg = os.path.abspath(os.path.join(os.path.dirname('__file__'),'animation','effects','mpbar.png'))

        super(ZippyGame,self).__init__(**kwargs)
        tempscale = Window.height / 256.
        self.map = BaseMap(os.path.abspath(os.path.join(os.path.dirname('__file__'),'Maps','prototype1','16px-680x800-metal.tmx')),
            Window.size,tempscale)
        spawn = self.map.map.layers['start'].find('spawn')[0]
        self.zipmeter = ZipMeter()
        self.sprite = Player_Sprite((spawn.px,spawn.py),self.map)
        self.add_widget(self.map)
        self.map.add_widget(self.sprite)
        self.add_widget(self.zipmeter)
        Clock.schedule_interval(self.update, 1.0/60.0)
项目:zipper    作者:richarddun    | 项目源码 | 文件源码
def consider_collide(self,pushx,pushy):
        """
        method to recursively find the point on a straight line where a collision occurs with
        tile object containing collision properties (t,b,l,r : top, bottom, left, right)
        Updates an Rect instance value with the x,y location at the point of collision for
        later use.  Uses recursion instead of iteration because endpoint is not known prior to
        calling the method.

        :param pushx: normalised vector describing the direction to move, already pre-computed by the touch angle
        plus the touch location
        :param pushy: normalised vector describing the direction to move, already pre-computed by the touch angle
        plus the touch location
        :return: always returns None
        """
        self.plotrect = Rect((self.pos[0]+(self.width*.42))+pushx,(self.pos[1]+(self.height*.35))+pushy,
                             self.size[0]*.16, self.size[1]*.29)
        numnum = len(self.map.map.layers['blocker'].collide(self.plotrect, 'blocker'))
        if numnum >= 1:
            return None
        pushx += self.movedir.x
        pushy += self.movedir.y
        self.consider_collide(pushx,pushy)
项目:Sandra-Programming    作者:pythongiant    | 项目源码 | 文件源码
def __init__(self,stuff):
        close=Label(text=stuff)
        popup=Popup(title="Meetings",size_hint=(None, None), size=(500, 400))

        root=ScrollView(size_hint=(1, None), size=(Window.width, Window.height))
        popup.add_widget(close)
        root.add_widget(popup)
        popup.open()
项目:RKSV    作者:ztp-at    | 项目源码 | 文件源码
def getModalView():
    return ModalView(size_hint=(1, None), pos_hint={'top': 1},
            height=Window.height - Window.keyboard_height,
            auto_dismiss=False)
项目:RKSV    作者:ztp-at    | 项目源码 | 文件源码
def getPopup(title, content):
    return Popup(title=title, content=content,
            size_hint=(0.9, None), pos_hint={'top': 1},
            height=Window.height - Window.keyboard_height)
项目:RKSV    作者:ztp-at    | 项目源码 | 文件源码
def updateHeight(self, instance, value):
        for c in Window.children:
            c.height = Window.height - Window.keyboard_height
项目:RKSV    作者:ztp-at    | 项目源码 | 文件源码
def getModalView():
    return ModalView(size_hint=(1, None), pos_hint={'top': 1},
            height=Window.height - Window.keyboard_height,
            auto_dismiss=False)
项目:RKSV    作者:ztp-at    | 项目源码 | 文件源码
def getPopup(title, content):
    return Popup(title=title, content=content,
            size_hint=(0.9, None), pos_hint={'top': 1},
            height=Window.height - Window.keyboard_height)
项目:zipper    作者:richarddun    | 项目源码 | 文件源码
def __init__(self, *args, **kwargs):
        self.mplevelmodifier = 0
        self.hplevelmodifier = 0
        self.width, self.height = Window.size
        self.scale = self.height / 256.      # 21 tile size * 12
        self.origlevels = self.hplevel = self.mplevel = self.scale * 57 #  Len of the HP/MP bar

        super(ZipMeter, self).__init__(*args, **kwargs)
项目:zipper    作者:richarddun    | 项目源码 | 文件源码
def __init__(self):
        self.width, self.height = Window.size
        self.scale = self.height / 256.      # 21 tile size * 12
项目:zipper    作者:richarddun    | 项目源码 | 文件源码
def zip(self, *ignore):
        """
        method to move sprite image along movedir, previously computed by prep_zip.
        also checks for collision with objects
        :return: none
        """
        self.texture = self.animage['arrow']
        self.consider_collide(self.movedir.x,self.movedir.y)
        za_collide_point = Vector(self.plotrect.center)  # Zero Aligned collide point
        za_origin = Vector(self.new.center)  # Zero Aligned origin
        asa_collider = za_collide_point - za_origin  # Need the length of the true vector before normalisation
        sa_collider = asa_collider.normalize()  # Now normalise for use in iteration later
        #len_to_collide = int(round(asa_collider.length()))
        len_to_collide = self.animlen  # Arbitrary number TODO - implement a better method to decide the len of travel
        if len_to_collide > 0:  # added to ensure 0 length handling, as it's instantiated as zero
            self.zipping = True
            for index,coltick in enumerate(xrange(1, len_to_collide)):
                lastRect = Rect(self.pos[0]+(self.width*.42)+(sa_collider[0]*index), self.pos[1]+(self.height*.35)
                                +(sa_collider[1]*index),(self.size[0]*.16), self.size[1]*.29)
                #  In brief :
                #  Rect with bottomleft x value of sprite x position, plus 42% of the image width (image is small within
                #  transparent larger image) plus sa_collider[0] - x value of normalised vector direction to collide
                #  point multiplied by index to ensure the 'lastRect' is always 1 iteration behind the 'newRect'
                #  Next values supplied to Rect are for y location, similar logic
                #  Further values relate to the height/width of the rect instance which should envelope the inner
                #  sprite drawing.  For the purposes of this calculation that's not so important.
                newRect = Rect(self.pos[0]+(self.width*.42)+(sa_collider[0]*coltick), self.pos[1]+(self.height*.35)
                                +(sa_collider[1]*coltick),(self.size[0]*.16), self.size[1]*.29)
                #  Multiply by coltick for newRect to ensure it's always 1 step ahead of lastRect

                if self.move_or_collide(Rect1=newRect, Rect2=lastRect):
                    break
            self.animcoords = newRect.bottomleft[0]-self.width*.42, newRect.bottomleft[1]-self.height*.35
            anim = Animation(x = self.animcoords[0], y = self.animcoords[1], duration=self.animduration)
            self.animlen = 0
            anim.start(self)
            Clock.schedule_once(self.notzipping,self.animduration)  # schedule the logic updates after animation ends
项目:SerpentAI    作者:SerpentAI    | 项目源码 | 文件源码
def __init__(self):
        super().__init__()

        self.images = dict()

        self.root = FloatLayout(size=(Window.width, Window.height))
        self.grid = GridLayout(cols=8)

        self.add_widget(self.root)
        self.root.add_widget(self.grid)

        for i, bucket in enumerate(config["visual_debugger"]["available_buckets"]):
            layout = BoxLayout(orientation="vertical")

            image = VisualDebuggerImage(
                allow_stretch=True
            )

            image.bind(texture=image.update_texture_filters)

            self.images[bucket] = image

            layout.add_widget(image)

            label = Label(
                text=bucket,
                color=(1, 1, 1, 1),
                size_hint=(1, 0.1)
            )

            layout.add_widget(label)

            self.grid.add_widget(layout)

        Window.bind(on_resize=self.on_window_resize)
        Window.clearcolor = (0.136, 0.191, 0.25, 1)
项目:SerpentAI    作者:SerpentAI    | 项目源码 | 文件源码
def on_window_resize(self, window, width, height):
        self.root.size = (width, height)
项目:mmplayer    作者:Bakterija    | 项目源码 | 文件源码
def on_start(self):
        self.store_name = 'MMplayerApp'
        self.store_properties = [
            ('last_size', [Window.width, Window.height]),
            ('last_pos', [Window.left, Window.top])
        ]
        self.update_store_properties()

        self.root.init_widgets()
        self.last_frame_time = time() - TIME0
        Logger.info('App: on_start: %s' % (round(self.last_frame_time, 2)))
        Clock.schedule_once(lambda dt: self.on_some_frame(1, 7), 0)
        Clock.schedule_once(self._load_window_pos_size, 0)
项目:GravBox    作者:GravBoxInterface    | 项目源码 | 文件源码
def __init__(self, **kwargs):
        super(WelcomeScreen, self).__init__(**kwargs)

        self.layout = FloatLayout() #Float Layout for positioning buttons and image anywhere on the screen
        self.layout.width = Window.width #the float layout is the size of the window
        self.layout.height = Window.height
        self.layout.x = Window.width/2 - self.layout.width/2 #sets the x position of the layout to 0
        self.layout.y = Window.height/2 - self.layout.height/2 #sets the y position of the layout to 0
        self.add_widget(self.layout) #adds the layout to the screen

        self.img = Image(source = self.welcomeImage)
        self.img.size = (Window.width*1.0, Window.height*1.2)
        self.img.pos = (-Window.width*0.0, -Window.height*0.0)
        self.img.opacity = 1.0 #alpha value between 0.0 - 1.0
        self.add_widget(self.img) #adds the image to the screen

        tmpBtn1 = MyButton(text = self.buttonList[0]) #start button
        tmpBtn1.size_hint = (.21, .09)
        tmpBtn1.pos_hint ={'x': .395, 'y': .24}
        tmpBtn1.background_color = [.4, .4, .4, .4] #backgroundcolor of the button (this is grayish)
        tmpBtn1.bind(on_release = self.changer) #when the button is released the changer function is called
        self.layout.add_widget(tmpBtn1) #adds the button called tmpBtn1 to the floatlayout

        tmpBtn2 = MyButton(text = self.buttonList[1]) #about button
        tmpBtn2.size_hint = (.08, .095)
        tmpBtn2.pos_hint ={'x': .618, 'y': 0}
        tmpBtn2.background_color = [.4, .4, .4, .4]
        tmpBtn2.bind(on_release = self.about) #when the button is released the about function is called
        self.layout.add_widget(tmpBtn2) #adds the button called tmpBtn2 to the floatlayout

        tmpBtn3 = MyButton(text = self.buttonList[2]) #uiowa button
        tmpBtn3.size_hint = (.08, .095)
        tmpBtn3.pos_hint = {'x':.7, 'y': 0}
        tmpBtn3.background_color = [.4, .4, .4, .4]
        tmpBtn3.bind(on_release = self.uiowa) #when the button is released the uiowa function is called
        self.layout.add_widget(tmpBtn3) #adds the button called tmpBtn3 to the floatlayout
项目:GravBox    作者:GravBoxInterface    | 项目源码 | 文件源码
def __init__(self, **kwargs):
        super(AboutScreen, self).__init__(**kwargs)

        self.layout = FloatLayout()
        self.layout.width = Window.width
        self.layout.height = Window.height
        self.layout.x = Window.width/2 - self.layout.width/2
        self.layout.y = Window.height/2 - self.layout.height/2
        self.add_widget(self.layout)

        self.img = Image(source = self.aboutImage)
        self.img.size = (Window.width*1.0, Window.height*1.0)
        self.img.pos = (-Window.width*0.0, -Window.height*0.0)
        self.img.opacity = 0.4
        self.add_widget(self.img)

        self.aboutText = Label(text= 'GravBox is the interface application for the Augmented Reality (AR) Sandbox for gravitational dynamics simulations designed and built\n by Dr. Hai Fu\'s Introduction to Astrophysics class during the 2016-2017 academic year and beyond.\n GravBox itself was designed by Zachary Luppen, Erin Maier, and Mason Reed.\n\nAR Sandbox is the result of an NSF-funded project on informal science education for freshwater lake and watershed science developed by the\n UC Davis\' W.M. Keck Center for Active Visualization in the Earth Sciences (KeckCAVES),\n together with the UC Davis Tahoe Environmental Research Center, Lawrence Hall of Science, and ECHO Lake Aquarium and Science Center.')
        self.aboutText.pos = (.5, .5)
        #self.aboutText.size = self.size
        self.add_widget(self.aboutText)

        tmpBtn1 = MyButton(text = 'BACK') #start button
        tmpBtn1.size_hint = (.1, .1)
        tmpBtn1.pos_hint ={'x': 0, 'y': .90}
        tmpBtn1.background_color = [.4, .4, .4, 1]
        tmpBtn1.bind(on_release = self.backButton) #when the button is released the callback function is called
        self.layout.add_widget(tmpBtn1)
项目:GravBox    作者:GravBoxInterface    | 项目源码 | 文件源码
def __init__(self, **kwargs):
        super(UiowaScreen, self).__init__(**kwargs)

        self.layout = FloatLayout()
        self.layout.width = Window.width
        self.layout.height = Window.height
        self.layout.x = Window.width/2 - self.layout.width/2
        self.layout.y = Window.height/2 - self.layout.height/2
        self.add_widget(self.layout)

        self.img = Image(source = self.uiowaImage)
        self.img.size = (Window.width*1.0, Window.height*1.0)
        self.img.pos = (-Window.width*0.0, -Window.height*0.0)
        self.img.opacity = 0.4
        self.add_widget(self.img)

        self.aboutText = Label(text= 'UIOWA INFO HERE')
        self.aboutText.pos = (.25, .25)
        self.add_widget(self.aboutText)

        tmpBtn1 = MyButton(text = 'BACK') #start button
        tmpBtn1.size_hint = (.1, .1)
        tmpBtn1.pos_hint ={'x': 0, 'y': .9}
        tmpBtn1.background_color = [.4, .4, .4, 1]
        tmpBtn1.bind(on_release = self.backButton) #when the button is released the backButton function is called
        self.layout.add_widget(tmpBtn1)
项目:GravBox    作者:GravBoxInterface    | 项目源码 | 文件源码
def __init__(self, **kwargs):
        super(WelcomeScreen, self).__init__(**kwargs)

        layout = FloatLayout() #Float Layout for positioning buttons and image anywhere on the screen
        layout.width = Window.width #the float layout is the size of the window
        layout.height = Window.height
        layout.x = Window.width/2 - layout.width/2 #sets the x position of the layout to 0
        layout.y = Window.height/2 - layout.height/2 #sets the y position of the layout to 0
        self.add_widget(layout) #adds the layout to the screen

        img = Image(source = self.welcomeImage) #BACKGROUND IMAGE
        img.size = (Window.width*1.0, Window.height*1.0)
        img.pos = (-Window.width*0.0, -Window.height*0.0)
        img.opacity = 1.0 #alpha value between 0.0 - 1.0
        self.add_widget(img) #adds the image to the screen

        startBtn = MyButton(text = '') #start button
        startBtn.size_hint = (.21, .09)
        startBtn.pos_hint ={'x': .395, 'y': .24}
        startBtn.background_color = [.4, .4, .4, .4] #backgroundcolor of the button (this is grayish)
        startBtn.bind(on_release = self.changer) #when the button is released the changer function is called
        self.add_widget(startBtn) #adds the button called startButton to the floatlayout

        aboutBtn = MyButton(text = '') #about button
        aboutBtn.size_hint = (.08, .095)
        aboutBtn.pos_hint ={'x': .618, 'y': 0}
        aboutBtn.background_color = [.4, .4, .4, .4]
        aboutBtn.bind(on_release = self.about) #when the button is released the about function is called
        self.add_widget(aboutBtn) #adds the button called aboutBtn to the floatlayout

        uiowaBtn = MyButton(text = '') #uiowa button
        uiowaBtn.size_hint = (.08, .095)
        uiowaBtn.pos_hint = {'x':.7, 'y': 0}
        uiowaBtn.background_color = [.4, .4, .4, .4]
        uiowaBtn.bind(on_release = self.uiowa) #when the button is released the uiowa function is called
        self.add_widget(uiowaBtn) #adds the button called uiowaBtn to the floatlayout
项目:GravBox    作者:GravBoxInterface    | 项目源码 | 文件源码
def __init__(self, **kwargs):
        super(AboutScreen, self).__init__(**kwargs)

        layout = FloatLayout()
        layout.width = Window.width
        layout.height = Window.height
        layout.x = Window.width/2 - layout.width/2
        layout.y = Window.height/2 - layout.height/2
        self.add_widget(layout)

        img = Image(source = self.aboutImage)
        img.size = (Window.width*1.0, Window.height*1.0)
        img.pos = (-Window.width*0.0, -Window.height*0.0)
        img.opacity = 0.4
        self.add_widget(img)

        aboutText = Label(text= 'GravBox is the interface application for the Augmented Reality (AR) Sandbox for gravitational dynamics simulations designed and built\nby Dr. Hai Fu\'s Introduction to Astrophysics class during the 2016-2017 academic year and beyond.\nGravBox itself was designed by Zachary Luppen, Erin Maier, and Mason Reed.\n\nAR Sandbox is the result of an NSF-funded project on informal science education for freshwater lake and watershed science developed by the\nUC Davis\' W.M. Keck Center for Active Visualization in the Earth Sciences (KeckCAVES),\ntogether with the UC Davis Tahoe Environmental Research Center, Lawrence Hall of Science, and ECHO Lake Aquarium and Science Center.', halign='center', valign='center')
        aboutText.pos = (.25, .25)
        self.add_widget(aboutText)

        backBtn = MyButton(text = 'BACK') # back button
        backBtn.size_hint = (.1, .1)
        backBtn.pos_hint ={'x': 0, 'y': .90}
        backBtn.background_color = [.4, .4, .4, 1]
        backBtn.bind(on_release = self.backButton) #when the button is released the callback function is called
        self.add_widget(backBtn)
项目:GravBox    作者:GravBoxInterface    | 项目源码 | 文件源码
def __init__(self, **kwargs):
        super(WelcomeScreen, self).__init__(**kwargs)

        layout = FloatLayout() #Float Layout for positioning buttons and image anywhere on the screen
        layout.width = Window.width #the float layout is the size of the window
        layout.height = Window.height
        layout.x = Window.width/2 - layout.width/2 #sets the x position of the layout to 0
        layout.y = Window.height/2 - layout.height/2 #sets the y position of the layout to 0
        self.add_widget(layout) #adds the layout to the screen

        img = Image(source = self.welcomeImage) #BACKGROUND IMAGE
        img.size = (Window.width*1.0, Window.height*1.0)
        img.pos = (-Window.width*0.0, -Window.height*0.0)
        img.opacity = 1.0 #alpha value between 0.0 - 1.0
        self.add_widget(img) #adds the image to the screen

        startBtn = MyButton(text = '') #start button
        startBtn.size_hint = (.21, .09)
        startBtn.pos_hint ={'x': .395, 'y': .24}
        startBtn.background_color = [.306, .325, .4196, .4] #backgroundcolor of the button (this is grayish)
        startBtn.bind(on_release = self.changer) #when the button is released the changer function is called
        self.add_widget(startBtn) #adds the button called startButton to the floatlayout

        aboutBtn = MyButton(text = '') #about button
        aboutBtn.size_hint = (.08, .095)
        aboutBtn.pos_hint ={'x': .618, 'y': 0}
        aboutBtn.background_color = [.4, .4, .4, .4]
        aboutBtn.bind(on_release = self.about) #when the button is released the about function is called
        self.add_widget(aboutBtn) #adds the button called aboutBtn to the floatlayout

        uiowaBtn = MyButton(text = '') #uiowa button
        uiowaBtn.size_hint = (.08, .095)
        uiowaBtn.pos_hint = {'x':.7, 'y': 0}
        uiowaBtn.background_color = [.4, .4, .4, .4]
        uiowaBtn.bind(on_release = self.uiowa) #when the button is released the uiowa function is called
        self.add_widget(uiowaBtn) #adds the button called uiowaBtn to the floatlayout
项目:GravBox    作者:GravBoxInterface    | 项目源码 | 文件源码
def __init__(self, **kwargs):
        super(UiowaScreen, self).__init__(**kwargs)

        self.layout = FloatLayout()
        self.layout.width = Window.width
        self.layout.height = Window.height
        self.layout.x = 0
        self.layout.y = 0
        self.add_widget(self.layout)

        img = Image(source = self.uiowaImage)
        img.size = (Window.width*1.0, Window.height*1.0)
        img.pos = (0, 0)
        img.opacity = .8
        self.add_widget(img, 1)

        with self.layout.canvas: #sets canvas instructions for the rightlayout and draws a blue rect. filling the entire layout
            Color(1, 1, 1, .7) #WHITE
            Rectangle(pos=(.15 * self.layout.height, .30 * self.layout.height), size=(.45 * self.layout.width, .55 * self.layout.height))  

        qr = Image(source = self.qrCode)
        qr.size_hint = (.39, .39)
        qr.pos_hint = {'x': .56, 'y': .12}
        self.add_widget(qr)

        logo = Image(source=self.uiLogo)
        logo.size_hint = (.33, .33)
        logo.pos_hint = {'x': .59, 'y': .58}
        self.add_widget(logo)        

        uiowaText = Label(text= 'The GravBox project is the result of the hard work of students of the University of Iowa\'s Physics and Astronomy Department. To learn more about physics and astronomy at the University of Iowa, and the research work being done in these areas, please scan the QR code to the right.', valign='middle', halign='center', font_size='24sp', text_size=(.4 * self.layout.width, None), color=(0,0,0,1))
        uiowaText.pos_hint = {'x': -.18, 'y': .075}
        self.add_widget(uiowaText)

        backBtn = MyButton(text = 'BACK') # back button
        backBtn.size_hint = (.1, .1)
        backBtn.pos_hint ={'x': .27, 'y': .16}
        backBtn.background_color = [.4, .4, .4, 1]
        backBtn.bind(on_release = self.backButton) #when the button is released the callback function is called
        self.add_widget(backBtn)
项目:GravBox    作者:GravBoxInterface    | 项目源码 | 文件源码
def __init__(self, **kwargs):
        super(WelcomeScreen, self).__init__(**kwargs)

        layout = FloatLayout() #Float Layout for positioning buttons and image anywhere on the screen
        layout.width = Window.width #the float layout is the size of the window
        layout.height = Window.height
        layout.x = Window.width/2 - layout.width/2 #sets the x position of the layout to 0
        layout.y = Window.height/2 - layout.height/2 #sets the y position of the layout to 0
        self.add_widget(layout) #adds the layout to the screen

        img = Image(source = self.welcomeImage) #BACKGROUND IMAGE
        img.size = (Window.width*1.0, Window.height*1.0)
        img.pos = (-Window.width*0.0, -Window.height*0.0)
        img.opacity = 1.0 #alpha value between 0.0 - 1.0
        self.add_widget(img) #adds the image to the screen

        startBtn = MyButton(text = '') #start button
        startBtn.size_hint = (.21, .09)
        startBtn.pos_hint ={'x': .395, 'y': .24}
        startBtn.background_color = [.4, .4, .4, .4] #backgroundcolor of the button (this is grayish)
        startBtn.bind(on_release = self.changer) #when the button is released the changer function is called
        self.add_widget(startBtn) #adds the button called startButton to the floatlayout

        aboutBtn = MyButton(text = '') #about button
        aboutBtn.size_hint = (.08, .095)
        aboutBtn.pos_hint ={'x': .618, 'y': 0}
        aboutBtn.background_color = [.4, .4, .4, .4]
        aboutBtn.bind(on_release = self.about) #when the button is released the about function is called
        self.add_widget(aboutBtn) #adds the button called aboutBtn to the floatlayout

        uiowaBtn = MyButton(text = '') #uiowa button
        uiowaBtn.size_hint = (.08, .095)
        uiowaBtn.pos_hint = {'x':.7, 'y': 0}
        uiowaBtn.background_color = [.4, .4, .4, .4]
        uiowaBtn.bind(on_release = self.uiowa) #when the button is released the uiowa function is called
        self.add_widget(uiowaBtn) #adds the button called uiowaBtn to the floatlayout
项目:GravBox    作者:GravBoxInterface    | 项目源码 | 文件源码
def __init__(self, **kwargs):
        super(AboutScreen, self).__init__(**kwargs)

        layout = FloatLayout()
        layout.width = Window.width
        layout.height = Window.height
        layout.x = Window.width/2 - layout.width/2
        layout.y = Window.height/2 - layout.height/2
        self.add_widget(layout)

        img = Image(source = self.aboutImage)
        img.size = (Window.width*1.0, Window.height*1.0)
        img.pos = (-Window.width*0.0, -Window.height*0.0)
        img.opacity = 0.4
        self.add_widget(img)

        aboutText = Label(text= 'GravBox is the interface application for the Augmented Reality (AR) Sandbox for gravitational dynamics simulations designed and built\nby Dr. Hai Fu\'s Introduction to Astrophysics class during the 2016-2017 academic year and beyond.\nGravBox itself was designed by Zachary Luppen, Erin Maier, and Mason Reed.\n\nAR Sandbox is the result of an NSF-funded project on informal science education for freshwater lake and watershed science developed by the\nUC Davis\' W.M. Keck Center for Active Visualization in the Earth Sciences (KeckCAVES),\ntogether with the UC Davis Tahoe Environmental Research Center, Lawrence Hall of Science, and ECHO Lake Aquarium and Science Center.', halign='center', valign='center')
        aboutText.pos = (.25, .25)
        self.add_widget(aboutText)

        backBtn = MyButton(text = 'BACK') # back button
        backBtn.size_hint = (.1, .1)
        backBtn.pos_hint ={'x': 0, 'y': .90}
        backBtn.background_color = [.4, .4, .4, 1]
        backBtn.bind(on_release = self.backButton) #when the button is released the callback function is called
        self.add_widget(backBtn)
项目:mobileinsight-mobile    作者:mobile-insight    | 项目源码 | 文件源码
def __init__(self, **kw):
        """
        Initialization function. We will do the following task (in order):
        __[x] means already done in App__
            1. [x] Check if the device is rooted
            2. [x] Initialize necessary libs required by MobileInsight (e.g., libwireshark)
            3. [x] Check if Android's security policy allows MobileInsight to access diagnostic mode.
            This is mainly caused by SELinux
            4. [x] Create necessary folders on SDcard (e.g., /sdcard/mobileinsight/, /sdcard/mobileinsight/log/)
            5. Load built-in and 3rd-party plugins (located in /sdcard/mobileinsight/plugins/)
            6. [x] Check if the diagnostic mode is enabled
            7. Load configurations from the setting panel (configs stored in /sdcard/.mobileinsight.ini)
        """

        super(PluginsScreen, self).__init__(**kw)

        self.log_viewer = None

        self.plugins_list = get_plugins_list()

        self.terminal_stop = None
        self.terminal_thread = None
        bootup = True

        #used to shorten long widget names in popup menu
        shortenLabel = CoreLabel(markup = True, text_size = (Window.width/2.5, None), shorten_from = "right", font_size = 70)
        #Making and adding widgets to popup menu
        for name in self.plugins_list:
            widget = Button(id = name, markup = True, halign = "left", valign = "top", on_release = self.callback, background_normal = "", background_color = self.ids.selectButton.background_color)
            widget.text_size = (Window.width/2.25, Window.height/4)
            self.myLayout.add_widget(widget)

            app_path = self.plugins_list[name][0]
            if os.path.exists(os.path.join(app_path, "readme.txt")):
                with open(os.path.join(app_path, "readme.txt"), 'r') as ff:
                    my_description = ff.read()
            else:
                my_description = "no description."
            #shortening long widget names and making font size
            shortenedName = shortenLabel.shorten(name)
            font_size = "60"
            if Window.width < 1450:
                font_size = "45"
            widget.text = "[color=fffafa][size=70]"+ shortenedName + "[/size][size="+ font_size + "]\n"+ my_description+"[/size][/color]"

            if bootup:
                self.selectedPlugin = name
                self.ids.selectButton.text = "Select Plugin"
                bootup = False

        # register Broadcast Receivers.
        self.registerBroadcastReceivers()