main.py 文件源码

python
阅读 22 收藏 0 点赞 0 评论 0

项目: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
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号