I need immediate support pleaseee!!!!!

76 views
Skip to first unread message

Aladdin Hammodi

unread,
Jun 14, 2017, 5:24:41 AM6/14/17
to Kivy users support
hello,
im creating an app and im new with kivy 
my app is consisting of several screens and i want in each screen to write a few lines and have a button "Next" so when i press on it i move to next screen 
i did this 
<ScreenOne>:
    BoxLayout:
        Button:
            text: "Next"
            pos_hint: {"right":1,"bottom":1}
            font_size: 32
            color: 0, 0, 0, 1
            size: 50, 30
                
            on_press:  root.manager.current = 'screen_two'

first my button is not at the lower right corner 
and what should i do in order to add the few lines 
id i want to add a screen background should i just write
canvas:
source: "backgrond.png" # the name of the file

thx a lot 

Ivan Acevedo

unread,
Jun 14, 2017, 8:26:02 AM6/14/17
to Kivy users support
You must create a button for each screen, each button will take to the next screen

Leonardo Rodriguez

unread,
Jun 15, 2017, 7:38:36 PM6/15/17
to Kivy users support
The button is not in the lower right corner because you have a BoxLayout and there is only one Widget in it. Try FloatLayout.
I don't understand what you mean with the few lines.
To set a background image try this:

BoxLayout:
    canvas.before:
        Rectangle:
            size: self.size
            pos: self.pos
            source: "background.jpg"
    Button: (and so on)

El miércoles, 14 de junio de 2017, 6:24:41 (UTC-3), Aladdin Hammodi escribió:

Leonardo Rodriguez

unread,
Jun 15, 2017, 7:41:41 PM6/15/17
to Kivy users support
One more thing.

Another reason because you have a big button in your BoxLayout is because you used the size: 50,50 thinking that kivy is gonna take it. Kivy will ignore this because you should first do size_hint:None,None in order to Kivy take note about your size property.

Best Regards
Leo

Aladdin Hammodi

unread,
Jun 16, 2017, 9:46:47 AM6/16/17
to Kivy users support
thx a lot 
i wrote my code i n a different way now and i dont have any more errors but when i run my code i only got a black kivy screen and it fits my whole laptop screen 
this is my new code 
my purpose is to have a few screens, setup a background to the screen put a few lines and a next button to go to the other screen 
python file:
=====================
# File name FaceRecognition.py
import kivy

from kivy.app import App
from kivy.uix.floatlayout import FloatLayout
from kivy.uix.screenmanager import ScreenManager, Screen


# Define each screen

class ScreenOne(Screen):
    pass

class ScreenTwo(Screen):
    pass

class ScreenManagement(ScreenManager):
    pass




class FaceRecognitionApp(App):
    def build(self):
        return ScreenManagement()

if __name__=="__main__":
    FaceRecognitionApp().run()
     
============================

kv file :
===========================
# File name FaceRecognition.kv
#: kivy 1.9.1


ScreenManagement:
id: screen_management
ScreenOne:
ScreenTwo:

<MyButton@Button>:
color: .8,.9,0,1 # yellow color
font_size: 32 # font size
size_hint: .2,.1
<ScreenOne>:
name: "screen1"
id: screen_one
FloatLayout:
Label:
text:"Hello\n Welcome to my App\n"
font_size:40 
color: 0,0,0,1
MyButton:
text: 'Next'
pos_hint:{'right':1, 'y':0}
on_press:root.manager.current="screen2"
<ScreenOne>:
name: "screen2"
id: screen_two
FloatLayout:
Label:
text:"Please insert your Name\n Please insert your Password\n"
font_size:40 
color: 0,0,0,1
MyButton:
text: 'Next'
pos_hint:{'right':1, 'y':0}
on_press:root.manager.current="screen1"

==================


ZenCODE

unread,
Jun 17, 2017, 4:27:29 PM6/17/17
to Kivy users support
You have tow rules in your kv for ScreenOne. The second should probably be ScreenTwo?

And you don't need the FloatLayouts inside the screens because they effective are FloatLayouts (RelativeLayouts to be exact). Hope that helps?

surmen

unread,
Jun 24, 2017, 6:22:35 AM6/24/17
to Kivy users support
had similar prob
Did u try
from kivy.lang import Builder


Builder.load_file( FaceRecognition.kv)

Also, u mistyped ScreenOne twice in ur kv file
Reply all
Reply to author
Forward
0 new messages