コード例 #1
0
 def setUp(self):
     TestPygletGUI.setUp(self)
     self.input = TextInput(text="test")
     self.manager = Manager(self.input,
                            window=self.window,
                            batch=self.batch,
                            theme=self.theme)
コード例 #2
0
ファイル: ui.py プロジェクト: dslice25/tinymmo-python
    def __init__(self, client):

        self.client = client
        self.login_button = OneTimeButton(label="Login", on_release=self.login)
        self.username_field = TextInput("")
        self.password_field = TextInput("")
        self.login_container = VerticalContainer(
            [self.login_button, self.username_field, self.password_field])
        Manager.__init__(self,
                         Frame(self.login_container),
                         window=self.client.window,
                         theme=UI_THEME)
コード例 #3
0
ファイル: ui.py プロジェクト: dslice25/tinymmo-python
    def __init__(self, client):

        self.client = client

        self.connect_button = OneTimeButton(label="Connect",
                                            on_release=self.connect)
        self.server_field = TextInput("localhost")
        self.port_field = TextInput("10000")
        self.connect_container = VerticalContainer(
            [self.connect_button, self.server_field, self.port_field])
        Manager.__init__(self,
                         Frame(self.connect_container, path='connectFrame'),
                         window=self.client.window,
                         theme=UI_THEME)
コード例 #4
0
class ReportAnswerWindow(Manager):
    def __init__(self):
        g.reportAnswerWindowOpened = True
        self._reportid=-1
        getReport(True)
        label1=Label("Answer to Ticket",bold=True,color=g.loginFontColor)
        closeBtn =HighlightedButton("",on_release=self.delete,width=19,height=19,path='delete')
        horzCont = HorizontalContainer(content=[label1,None,closeBtn])
        #self.infoLabel = Label("No reports founds")
        self.report = Document("",is_fixed_size=True,width=g.SCREEN_WIDTH/3,height=g.SCREEN_HEIGHT/4)
        self.reportInput = TextInput(text="",padding=0,length=16,max_length=500,width=g.SCREEN_WIDTH/3,height=g.SCREEN_HEIGHT/4,multiline=True)
        deleteBtn = HighlightedButton("Delete",on_release=self.remove,width=120,height=30)
        sendBtn = HighlightedButton("Send",on_release=self.send,width=120,height=30)
        buttons = HorizontalContainer(content=[deleteBtn,Spacer(0,0),sendBtn])
        frame = Frame(VerticalContainer(content=[horzCont,self.report,self.reportInput,buttons]))
        
        Manager.__init__(self,
            frame,
            window=g.screen,
            batch=g.guiBatch,
            is_movable=False,
            theme=g.theme)
        frame.expand(g.SCREEN_WIDTH/2,height=g.SCREEN_HEIGHT/4*3)    
    def send(self,event):
        if self._reportid!=None and self._reportid!=-1:
            solveReport(self._reportid,self.reportInput.get_text())
            infoText("Ticket has been marked as solved.")
            self.clear(None)
            getReport(True)
        #print self.reportInput.get_text()
        #sendReport(self.reportInput.get_text())
        #print self.reportInput.get_text()
        #self.delete(None)
        
    def remove(self,event):
        solveReport(self._reportid,"",True)
        infoText("Ticket has been marked as solved.")
        self.clear(None)
        getReport(True)
        
    def clear(self,event):
        self._reportid=-1
        self.report.set_text("")
        self.reportInput.set_text("")
    def delete(self,event):
        g.chatFocus=False
        self.reportInput.focused = False
        super(Manager,self).delete()
        g.reportAnswerWindowOpened = False
コード例 #5
0
ファイル: ui.py プロジェクト: dslice25/tinymmo-python
class ChatWindowManager(Manager):
    def __init__(self, client):

        self.client = client
        self.message_container = VerticalContainer(content=[],
                                                   align=HALIGN_LEFT)
        self.messages = Scrollable(height=100,
                                   width=300,
                                   is_fixed_size=True,
                                   content=self.message_container)
        self.text_input = TextInput("", length=20, max_length=256)
        self.send_button = OneTimeButton("Send",
                                         on_release=self.submit_message)
        self.enter_field = HorizontalContainer(
            [self.text_input, self.send_button])
        self.chat_window = VerticalContainer([self.messages, self.enter_field])
        Manager.__init__(self,
                         Frame(self.chat_window, path='chatFrame'),
                         window=self.client.window,
                         theme=UI_THEME,
                         is_movable=True,
                         anchor=ANCHOR_BOTTOM_LEFT)

    def add_message(self, message):

        step = 40
        for i in range(0, len(message), step):
            self.message_container.add(
                Label("> " + message[i:step], font_name='Lucida Grande'))
            step += 40

        self.text_input.set_text("")

    def submit_message(self, state):

        message = self.text_input.get_text()
        self.text_input.set_text("")

        if message[0] == "/":
            self.message_container.add(
                Label("> " + message,
                      font_name='Lucida Grande',
                      color=[200, 200, 255, 255]))
            self.client.command(message[1:].split(' '))
        else:
            self.client.chat(message)
コード例 #6
0
    def __init__(self):
        g.reportWindowOpened = True
        getReport()
        label1 = Label("Send Ticket", bold=True, color=g.loginFontColor)
        closeBtn = HighlightedButton("",
                                     on_release=self.delete,
                                     width=19,
                                     height=19,
                                     path='delete')
        horzCont = HorizontalContainer(content=[label1, None, closeBtn])
        #self.infoLabel = Label("No reports founds")
        self.reportInput = TextInput(text="",
                                     padding=5,
                                     length=16,
                                     max_length=400,
                                     width=g.SCREEN_WIDTH / 3,
                                     height=g.SCREEN_HEIGHT / 3,
                                     multiline=True)

        clearBtn = HighlightedButton("Clear",
                                     on_release=self.clear,
                                     width=120,
                                     height=30)
        deleteBtn = HighlightedButton("Delete",
                                      on_release=self.remove,
                                      width=120,
                                      height=30)
        sendBtn = HighlightedButton("Send",
                                    on_release=self.send,
                                    width=120,
                                    height=30)
        buttons = HorizontalContainer(content=[clearBtn, deleteBtn, sendBtn])
        frame = Frame(
            VerticalContainer(content=[horzCont, self.reportInput, buttons]))

        Manager.__init__(self,
                         frame,
                         window=g.screen,
                         batch=g.guiBatch,
                         is_movable=False,
                         theme=g.theme)
        frame.expand(g.SCREEN_WIDTH / 2, height=g.SCREEN_HEIGHT / 4 * 3)
コード例 #7
0
ファイル: ui.py プロジェクト: dslice25/tinymmo-python
    def __init__(self, client):

        self.client = client
        self.message_container = VerticalContainer(content=[],
                                                   align=HALIGN_LEFT)
        self.messages = Scrollable(height=100,
                                   width=300,
                                   is_fixed_size=True,
                                   content=self.message_container)
        self.text_input = TextInput("", length=20, max_length=256)
        self.send_button = OneTimeButton("Send",
                                         on_release=self.submit_message)
        self.enter_field = HorizontalContainer(
            [self.text_input, self.send_button])
        self.chat_window = VerticalContainer([self.messages, self.enter_field])
        Manager.__init__(self,
                         Frame(self.chat_window, path='chatFrame'),
                         window=self.client.window,
                         theme=UI_THEME,
                         is_movable=True,
                         anchor=ANCHOR_BOTTOM_LEFT)
コード例 #8
0
    def initNameMene(self):
        def sendMeneName(event):
            self.menename = self.nameInput.get_text()
            if len(self.menename) > 0:
                self.saveBtn.disabled = True

        self.naming = True
        label = Label("Name Your Mene",
                      color=g.postColor,
                      font_size=18,
                      bold=True)
        #meneTheme = Theme({g.spriteName: {
        #                "image": {
        #                    "source": g.spriteName+'_front.png'
        #                },
        #                "gui_color": [255,255,255,255]
        #            }
        #        },resources_path=g.dataPath+'/menes/'
        #)
        #picture = Graphic(g.spriteName,alternative=meneTheme)
        picture = Graphic(
            texture=g.gameEngine.resManager.meneSprites[g.spriteName]['front'])
        self.nameInput = TextInput(text="",
                                   padding=2,
                                   length=12,
                                   max_length=12,
                                   width=200,
                                   font_size=16)
        self.saveBtn = HighlightedButton(label="Save",
                                         on_release=sendMeneName,
                                         width=100,
                                         height=40,
                                         font_size=16)
        frame = Frame(VerticalContainer(content=[
            label, picture,
            HorizontalContainer([self.nameInput, self.saveBtn])
        ]),
                      path='frame_npc_talk')
        self.meneMan = Manager(frame,
                               window=self.screen,
                               batch=g.guiBatch,
                               theme=g.theme,
                               offset=(0, 0),
                               is_movable=False)
コード例 #9
0
class TestInput(TestPygletGUI):
    def setUp(self):
        TestPygletGUI.setUp(self)
        self.input = TextInput(text="test")
        self.manager = Manager(self.input,
                               window=self.window,
                               batch=self.batch,
                               theme=self.theme)

    def test_focus(self):
        self.input.on_gain_focus()

        self.assertEqual(self.input.is_focus(), True)

        self.input.on_lose_focus()
        self.assertEqual(self.input.is_focus(), False)

    def test_input(self):
        self.assertEqual(self.input.get_text(), "test")
        self.input.on_gain_focus()
        self.input.on_text("text")
        self.assertEqual(
            self.input.get_text(),
            "text")  # it starts with all text selected, so 'test' is erased.
        self.input.on_text(" text")
        self.assertEqual(self.input.get_text(), "text text")

    def test_motion(self):
        self.input.on_gain_focus()

        self.input.on_text_motion(pyglet.window.key.MOTION_RIGHT)
        # 'test|' where | is the carret.
        self.assertEqual(self.input.get_text(), "test")

        self.input.on_text_motion(pyglet.window.key.MOTION_BACKSPACE)
        # 'tes|'
        self.assertEqual(self.input.get_text(), "tes")

        self.input.on_text_motion(pyglet.window.key.MOTION_LEFT)
        # 't|es'
        self.input.on_text_motion(pyglet.window.key.MOTION_LEFT)

        self.input.on_text_motion(pyglet.window.key.MOTION_DELETE)
        # 't|s'
        self.assertEqual(self.input.get_text(), "ts")

    def test_delete(self):
        self.manager.delete()

    def test_delete_without_focus(self):
        self.input.on_gain_focus()
        self.input.on_lose_focus()
        self.manager.delete()

    def test_delete_with_focus(self):
        self.input.on_gain_focus()
        self.manager.delete()
コード例 #10
0
 def __init__(self, **kwargs):
     _TextInput.__init__(self, **kwargs, max_length=5, length=6)
コード例 #11
0
class ReportWindow(Manager):
    def __init__(self):
        g.reportWindowOpened = True
        getReport()
        label1 = Label("Send Ticket", bold=True, color=g.loginFontColor)
        closeBtn = HighlightedButton("",
                                     on_release=self.delete,
                                     width=19,
                                     height=19,
                                     path='delete')
        horzCont = HorizontalContainer(content=[label1, None, closeBtn])
        #self.infoLabel = Label("No reports founds")
        self.reportInput = TextInput(text="",
                                     padding=5,
                                     length=16,
                                     max_length=400,
                                     width=g.SCREEN_WIDTH / 3,
                                     height=g.SCREEN_HEIGHT / 3,
                                     multiline=True)

        clearBtn = HighlightedButton("Clear",
                                     on_release=self.clear,
                                     width=120,
                                     height=30)
        deleteBtn = HighlightedButton("Delete",
                                      on_release=self.remove,
                                      width=120,
                                      height=30)
        sendBtn = HighlightedButton("Send",
                                    on_release=self.send,
                                    width=120,
                                    height=30)
        buttons = HorizontalContainer(content=[clearBtn, deleteBtn, sendBtn])
        frame = Frame(
            VerticalContainer(content=[horzCont, self.reportInput, buttons]))

        Manager.__init__(self,
                         frame,
                         window=g.screen,
                         batch=g.guiBatch,
                         is_movable=False,
                         theme=g.theme)
        frame.expand(g.SCREEN_WIDTH / 2, height=g.SCREEN_HEIGHT / 4 * 3)

    def send(self, event):
        sendReport(self.reportInput.get_text())
        #print self.reportInput.get_text()
        infoText('A ticket has been sent.')
        self.delete(None)

    def remove(self, event):
        if self.reportInput.get_text() != "":
            sendReport("")
            infoText('Your ticket has been deleted.')
            #self.clear(None)
        self.delete(None)

    def clear(self, event):

        self.reportInput.set_text("")

    def delete(self, event):
        g.chatFocus = False
        self.reportInput.focused = False
        super(Manager, self).delete()
        g.reportWindowOpened = False
コード例 #12
0
ファイル: test_text_input.py プロジェクト: Norberg/pyglet-gui
class TestInput(TestPygletGUI):

    def setUp(self):
        TestPygletGUI.setUp(self)
        self.input = TextInput(text="test")
        self.manager = Manager(self.input, window=self.window, batch=self.batch, theme=self.theme)

    def test_focus(self):
        self.input.on_gain_focus()

        self.assertEqual(self.input.is_focus(), True)

        self.input.on_lose_focus()
        self.assertEqual(self.input.is_focus(), False)

    def test_input(self):
        self.assertEqual(self.input.get_text(), "test")
        self.input.on_gain_focus()
        self.input.on_text("text")
        self.assertEqual(self.input.get_text(), "text")  # it starts with all text selected, so 'test' is erased.
        self.input.on_text(" text")
        self.assertEqual(self.input.get_text(), "text text")

    def test_motion(self):
        self.input.on_gain_focus()

        self.input.on_text_motion(pyglet.window.key.MOTION_RIGHT)
        # 'test|' where | is the carret.
        self.assertEqual(self.input.get_text(), "test")

        self.input.on_text_motion(pyglet.window.key.MOTION_BACKSPACE)
        # 'tes|'
        self.assertEqual(self.input.get_text(), "tes")

        self.input.on_text_motion(pyglet.window.key.MOTION_LEFT)
        # 't|es'
        self.input.on_text_motion(pyglet.window.key.MOTION_LEFT)

        self.input.on_text_motion(pyglet.window.key.MOTION_DELETE)
        # 't|s'
        self.assertEqual(self.input.get_text(), "ts")
コード例 #13
0
ファイル: test_text_input.py プロジェクト: Norberg/pyglet-gui
 def setUp(self):
     TestPygletGUI.setUp(self)
     self.input = TextInput(text="test")
     self.manager = Manager(self.input, window=self.window, batch=self.batch, theme=self.theme)
コード例 #14
0
ファイル: chat.py プロジェクト: sakkee/Spurdola-client
class Chat(Manager):
    def __init__(self):
        w1 = int(350 * (g.SCREEN_WIDTH / 1920.))
        h1 = int(300 * (g.SCREEN_HEIGHT / 1080.))
        if w1 > 300:
            g.chatTheme["font_size"] = 11
            g.theme["font_size"] = 11
            g.theme["button"]["font_size"] = 11
        elif w1 > 250:
            g.chatTheme["font_size"] = 12
            g.theme["font_size"] = 12
            g.theme["button"]["font_size"] = 12
            w1 = int(w1 * 1.1)
        elif w1 > 200:
            g.chatTheme["font_size"] = 11
            g.theme["font_size"] = 11
            g.theme["button"]["font_size"] = 11
            w1 = int(w1 * 1.2)
        elif w1 > 175:
            g.chatTheme["font_size"] = 10
            g.theme["font_size"] = 10
            g.theme["button"]["font_size"] = 10
            w1 = int(w1 * 1.3)
        else:
            g.chatTheme["font_size"] = 9
            g.theme["font_size"] = 9
            g.theme["button"]["font_size"] = 9
            w1 = int(w1 * 1.3)
        self.chatInput = TextInput(text="",
                                   padding=0,
                                   length=16,
                                   max_length=MAX_CHAT_INPUT,
                                   width=w1 - 5 - 50)
        sendButton = HighlightedButton(label="Send",
                                       on_release=self.sendMessage,
                                       width=50,
                                       height=35)
        realtext = '{font_size ' + str(
            g.chatTheme["font_size"]) + '}{background_color ' + str(
                g.postBgColor
            ) + '}{font_name "' + g.chatTheme["font"] + '"}{wrap "char"} '
        document = pyglet.text.decode_attributed(realtext)
        self.textArea = Document(document,
                                 width=w1,
                                 height=h1,
                                 background=True,
                                 font_size=g.chatTheme["font_size"],
                                 font_name=g.chatTheme["font"],
                                 chat=True)

        vertCont = VerticalContainer(content=[
            self.textArea,
            HorizontalContainer(content=[self.chatInput, sendButton])
        ],
                                     align=HALIGN_LEFT)
        Manager.__init__(self,
                         vertCont,
                         window=g.screen,
                         batch=g.guiBatch,
                         theme=g.chatTheme,
                         anchor=ANCHOR_BOTTOM_LEFT,
                         offset=(g.SCREEN_WIDTH * 0.05, g.SCREEN_HEIGHT * 0.1),
                         is_movable=False)
        #print self.__dict__
    def setPos(self, x, y):
        self.set_position(x, y)

    def sendMessage(self, event):
        g.chatReloaded = False
        text = self.chatInput.get_text()

        if text != "":
            sendChatMsg(text)
        else:
            g.chatting = None
        if not g.chatReloaded:
            self.chatInput.set_text("")
            if self._focus == self.chatInput:
                self._focus = None
                self.chatInput.on_lose_focus()
        self.chatInput.focused = False

    def delete(self):
        super(Manager, self).delete()

    def addText(self, constructedText):
        len1 = len(self.textArea._document.text)
        attributes = {}
        for c in constructedText._style_runs:
            for d in constructedText._style_runs[c]:
                if d[2] is not None:
                    attributes.update({str(c): d[2]})
        self.textArea._document.insert_text(len1, constructedText._text,
                                            attributes)
コード例 #15
0
ファイル: chat.py プロジェクト: sakkee/Spurdola-client
    def __init__(self):
        w1 = int(350 * (g.SCREEN_WIDTH / 1920.))
        h1 = int(300 * (g.SCREEN_HEIGHT / 1080.))
        if w1 > 300:
            g.chatTheme["font_size"] = 11
            g.theme["font_size"] = 11
            g.theme["button"]["font_size"] = 11
        elif w1 > 250:
            g.chatTheme["font_size"] = 12
            g.theme["font_size"] = 12
            g.theme["button"]["font_size"] = 12
            w1 = int(w1 * 1.1)
        elif w1 > 200:
            g.chatTheme["font_size"] = 11
            g.theme["font_size"] = 11
            g.theme["button"]["font_size"] = 11
            w1 = int(w1 * 1.2)
        elif w1 > 175:
            g.chatTheme["font_size"] = 10
            g.theme["font_size"] = 10
            g.theme["button"]["font_size"] = 10
            w1 = int(w1 * 1.3)
        else:
            g.chatTheme["font_size"] = 9
            g.theme["font_size"] = 9
            g.theme["button"]["font_size"] = 9
            w1 = int(w1 * 1.3)
        self.chatInput = TextInput(text="",
                                   padding=0,
                                   length=16,
                                   max_length=MAX_CHAT_INPUT,
                                   width=w1 - 5 - 50)
        sendButton = HighlightedButton(label="Send",
                                       on_release=self.sendMessage,
                                       width=50,
                                       height=35)
        realtext = '{font_size ' + str(
            g.chatTheme["font_size"]) + '}{background_color ' + str(
                g.postBgColor
            ) + '}{font_name "' + g.chatTheme["font"] + '"}{wrap "char"} '
        document = pyglet.text.decode_attributed(realtext)
        self.textArea = Document(document,
                                 width=w1,
                                 height=h1,
                                 background=True,
                                 font_size=g.chatTheme["font_size"],
                                 font_name=g.chatTheme["font"],
                                 chat=True)

        vertCont = VerticalContainer(content=[
            self.textArea,
            HorizontalContainer(content=[self.chatInput, sendButton])
        ],
                                     align=HALIGN_LEFT)
        Manager.__init__(self,
                         vertCont,
                         window=g.screen,
                         batch=g.guiBatch,
                         theme=g.chatTheme,
                         anchor=ANCHOR_BOTTOM_LEFT,
                         offset=(g.SCREEN_WIDTH * 0.05, g.SCREEN_HEIGHT * 0.1),
                         is_movable=False)
コード例 #16
0
from pyglet_gui.text_input import TextInput
from pyglet_gui.theme import Theme

theme = Theme(
    {
        "font": "Lucida Grande",
        "font_size": 12,
        "text_color": [255, 255, 255, 255],
        "gui_color": [255, 0, 0, 255],
        "input": {
            "image": {
                "source": "input.png",
                "frame": [3, 3, 2, 2],
                "padding": [3, 3, 2, 3]
            },
            # need a focus color
            "focus_color": [255, 255, 255, 64],
            "focus": {
                "image": {
                    "source": "input-highlight.png"
                }
            }
        }
    },
    resources_path='../theme/')

# Set up a Manager
Manager(TextInput(text="Write on me"), window=window, batch=batch, theme=theme)

pyglet.app.run()
コード例 #17
0
    def initManagers(self):
        g.gameEngine.changeMusicSong(LOGINMENUSONG)
        g.gameEngine.musicManager.volume = g.MUSICVOLUME
        self.skyHeight = int(0.4592592 * g.SCREEN_HEIGHT)
        self.skyWidth = int(1.625 * g.SCREEN_WIDTH)
        self.ukkeliSprite._set_scale(self.screen.width / 1920.0)
        #self.ukkeliSprite.anchor_x=self.ukkeliSprite.width//2
        #self.ukkeliSprite.anchor_y=self.ukkeliSprite.height//2

        self.ukkeliSprite.x = 0.5 * self.screen.width
        self.ukkeliSprite2._set_scale(self.screen.width / 1920.0)
        self.ukkeliSprite2.x = 0.5 * self.screen.width
        #self.ukkeliSprite2.anchor_x=self.ukkeliSprite2.width//2
        #self.ukkeliSprite2.anchor_y=self.ukkeliSprite2.height//2
        self.logo._set_scale(self.screen.width / 1920.0)
        self.logo.x = (self.screen.width - self.l1.width *
                       (self.screen.width / 1920.0)) / 2
        self.logo.y = (self.screen.height - 350) * (1080.0 /
                                                    self.screen.height)

        self.charTick = int(
            (datetime.datetime.utcnow() -
             datetime.datetime(1970, 1, 1)).total_seconds() * 1000)

        label = Label("Username", color=g.loginFontColor, font_size=18)
        label1 = Label("Password", color=g.loginFontColor, font_size=18)
        self.logininput = TextInput(text="",
                                    padding=2,
                                    length=16,
                                    max_length=16,
                                    width=220,
                                    font_size=18)
        self.passwordinput = TextInput(text="",
                                       font=g.defaultPWFont.name,
                                       padding=0,
                                       length=21.5,
                                       width=220,
                                       font_size=18)

        self.button = HighlightedButton(label="Login",
                                        on_release=self.tryLogin,
                                        width=210,
                                        height=50,
                                        font_size=16)

        vertCont = VerticalContainer([
            label, self.logininput,
            Spacer(min_height=10), label1, self.passwordinput,
            Spacer(min_height=40), self.button
        ])

        versionInfo = Label("Version: " + GAME_VERSION,
                            color=(0, 0, 0, 255),
                            font_size=10)
        self.exitButton = HighlightedButton(label="Exit",
                                            on_release=self.exit,
                                            width=100,
                                            height=40,
                                            font_size=14)
        vertCont2 = VerticalContainer([versionInfo, self.exitButton])
        self.man1 = Manager(vertCont,
                            window=self.screen,
                            batch=g.guiBatch,
                            theme=g.theme,
                            offset=(0, -50),
                            is_movable=False)
        self.man2 = Manager(vertCont2,
                            window=self.screen,
                            batch=g.guiBatch,
                            theme=g.theme,
                            anchor=ANCHOR_BOTTOM_RIGHT,
                            offset=(-50, 50),
                            is_movable=False)
        self.man1.set_focus(self.logininput)
コード例 #18
0
ファイル: sidebar.py プロジェクト: luntan365/Physics_Sim
    def viewer(self):
        elems = {}

        # Title
        elems['title'] = Label('Customize Material')

        # Particle shape setting
        elems['shape'] = HoriCont([
            GroupButton(group_id='shape', label='Circle', is_pressed=True),
            GroupButton(group_id='shape', label='Square')
        ])

        # Size setting
        """ Temporarily removed to work on same-size optimization
        r_display = Label('3.0 m')
        r_slider = HoriSlide(on_set=lambda x: self.lbl_slider(x,
                                                              r_display,
                                                              after=' m'),
                             min_value=1,
                             max_value=10,
                             value=3)

        elems['radius'] = HoriCont([r_display, r_slider])
        """

        # Mass setting
        m_display = Label('1.00 kg')
        m_slider = HoriSlide(on_set=lambda x: self.lbl_slider(
            x, m_display, digits=4, after=' kg'),
                             min_value=1,
                             max_value=100,
                             value=1)
        elems['mass'] = HoriCont([m_display, m_slider])

        max_vel = 50
        # Velocity_x setting
        vx_lbl = Label('X velocity:')
        vx_display = Label('0.0 m/s')
        vx_slider = HoriSlide(on_set=lambda x: self.lbl_slider(
            x, vx_display, digits=3, after=' m/s'),
                              min_value=-1 * max_vel,
                              max_value=max_vel,
                              value=0)
        elems['x_velocity'] = VertCont(
            [vx_lbl, HoriCont([vx_display, vx_slider])])

        # Velocity_y setting
        vy_lbl = Label('Y velocity:')
        vy_display = Label('0.0 m/s')
        vy_slider = HoriSlide(on_set=lambda x: self.lbl_slider(
            x, vy_display, digits=3, after=' m/s'),
                              min_value=-1 * max_vel,
                              max_value=max_vel,
                              value=0)
        elems['y_velocity'] = VertCont(
            [vy_lbl, HoriCont([vy_display, vy_slider])])

        # Color setting
        red_in = TextInput(
            ' 255',
            length=4,
            max_length=4,
            on_input=lambda x: self.color_input(x, 'red', red_in))
        green_in = TextInput(
            ' 0',
            length=4,
            max_length=4,
            on_input=lambda x: self.color_input(x, 'green', green_in))
        blue_in = TextInput(
            ' 0',
            length=4,
            max_length=4,
            on_input=lambda x: self.color_input(x, 'blue', blue_in))
        elems['color'] = HoriCont([red_in, green_in, blue_in])

        # Gravity setting
        elems['gravity'] = Checkbox('Has gravity', is_pressed=False)

        self.elems = elems

        sidebar = Frame(VertCont(self.get_elem_list(), padding=20))

        return sidebar