border color

1,339 views
Skip to first unread message

John Fabiani

unread,
May 23, 2014, 1:05:55 AM5/23/14
to kivy-...@googlegroups.com
Hi,

I guess I don't understand the "borderimage" info.  The doc's suggest that I can change the color in a similar manner that happens in CSS.
This is how I would do it in CSS:
{
border-style:solid;
border-color:#ff0000 #0000ff;
}

But I don't understand how to apply it to a border for a bubble.

Can some kind sole help out with an example.

Thanks in advance,
Johnf

below is some simple code (from the web).

from kivy.app import App
from kivy.uix.floatlayout import FloatLayout

from kivy.uix.gridlayout import GridLayout
from kivy.uix.button import Button
from kivy.uix.bubble import Bubble
from kivy.uix.bubble import BubbleButton
 
class MyBubbleApp(App):
    def build(self):
        
        root= GridLayout()
        layout = FloatLayout(orientation='horizontal', size=(150,100), size_hint=(None, None))
        my_btn=Button(text='Press to view bubble',pos=(300,300),on_press=show_bubble)
        layout.add_widget(my_btn)
        root.add_widget(layout)
        return root
 
def show_bubble(self,*args):
        my_bubble= Bubble(orientation = 'horizontal',pos=(160,400))
        my_bubble.padding = [10,10,10,10]
        my_bubble.width=240
        #Customizing my bubble
        my_bubble.background_color =(250, 69, 0, 1)
        my_bubble.border = [20,20, 20, 20]
        my_bubble.arrow_pos= 'top_mid'
        my_bub_btn1= BubbleButton(text='NEW',size_hint=(None, None),size=(40, 50))
        my_bub_btn2= BubbleButton(text='OR',size_hint=(None, None),size=(20, 50))
        my_bub_btn3= BubbleButton(text='EXISTING CUSTOMERS',size_hint=(None, None),size=(160, 50))       
        ##Add items to bubble
        my_bubble.add_widget(my_bub_btn1)
        my_bubble.add_widget(my_bub_btn2)
        my_bubble.add_widget(my_bub_btn3)
        self.add_widget(my_bubble)
        
      
if __name__ == '__main__':
    MyBubbleApp().run()

John Fabiani

unread,
May 23, 2014, 6:07:00 PM5/23/14
to kivy-...@googlegroups.com
Not one answer?  I really could use some help.  I just don't how to use the border.  I want a contrasting color around a bubble - but for tutorial purpose make it work with a rect where the programmer is choosing the color for the border.

Jophnf

qua non

unread,
May 24, 2014, 5:16:34 AM5/24/14
to kivy-...@googlegroups.com
where does the doc suggest that you can use border color?


--
You received this message because you are subscribed to the Google Groups "Kivy users support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kivy-users+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

John Fabiani

unread,
May 24, 2014, 12:47:50 PM5/24/14
to kivy-...@googlegroups.com
It does not! How silly of me! But then I wonder why when I look at
several of the examples and run them and then see that the
border/outline of the bubble is in fact a different color. So unlike
CSS (which the doc's do in fact suggest is similar) I can't just set the
color of a border. There must a trick - which I think I'm just now
starting to understand. I think setting the background color and then
adding a background image of a different color and adding a border
produces the effect. I haven't tested this theory at this point but I
think it might work.

<rant>
Being new to the code and just learning (a steep learning curve I might
add) I wonder why the widgets are not more advanced. For example there
are many posting asking for rounded corners. The requests go back a
couple of years. Yet no rounded corners. So far everything I see is
based on a rect. So I wonder is it the underlying code that is
preventing it or just the demands of all the different requests of an
open source team. I haven't used C in many years but I downloaded the
source. My hope is I can understand the source and structure to the
point I might be able to help.
</rant>
Johnf

qua non

unread,
May 24, 2014, 3:11:25 PM5/24/14
to kivy-...@googlegroups.com
There have been numerous posts answering it... simply use a image with rounded edges.... set the image borders to be of different color(within the image itself). 

So in code all you need to do is set the border property to be the size of the borders in your image in pixels. in doubt on how to exactly do this ? look at the examples dir.. the sequenced images example should have a example of how to use borders and the effects it presents.

I guess we should also add a example in the doc just for making stuff easier to find.

Thanks for the pointer. 



--
You received this message because you are subscribed to the Google Groups "Kivy users support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kivy-users+unsubscribe@googlegroups.com.

John Fabiani

unread,
May 26, 2014, 3:21:43 PM5/26/14
to kivy-...@googlegroups.com
Thanks for the heads up.
Johnf
To unsubscribe from this group and stop receiving emails from it, send an email to kivy-users+...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "Kivy users support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kivy-users+...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages