Oaks-view
Oaks-view

Reputation: 413

Remove kivy text input boarders

Is there a way to remove the boarder line around a text input or make it invisible?

Sample code would be appreciated.

Upvotes: 3

Views: 2316

Answers (2)

SagitSri
SagitSri

Reputation: 521

If you don't want borders try this:

TextInput:  
    background_color: 0,0,0,0  
    foreground_color: 0,1,255,0.7

This will set TextInput to black and no white color inside the TextInput.

Upvotes: 2

Nykakin
Nykakin

Reputation: 8747

TextInput uses as a default theme following images:

As you can see, both images contain borders. To remove them, create a white colored image (can be 1x1 pixel) and use it as a background:

from kivy.app import App
from kivy.lang import Builder
from kivy.uix.floatlayout import FloatLayout
from kivy.clock import Clock

Builder.load_string("""
<MyWidget>:  
    canvas:
        Color:
            rgb: 0.5, 0.8, 1
        Rectangle:
            size: self.size
            pos: self.pos
    TextInput
        size_hint: 0.5, 0.5
        pos_hint: { 'center_x' : 0.5, 'center_y' : 0.5 }
        background_normal: 'white.png'
        background_active: 'white.png'
""")

class MyWidget(FloatLayout):
    pass

class ClientApp(App):
    def build(self):
        return MyWidget()

if __name__ == '__main__':
    ClientApp().run()

You can also consider creating your own atlas .

Upvotes: 6

Related Questions