kivy-language

Highlight a Kivy ToggleButton with mouse hovering

白昼怎懂夜的黑 提交于 2019-12-01 23:52:48
I am currently coding a GUI with Kivy. I need to modify a ToggleButton behaviour so that it is highlighted when hovered by the mouse. Here is my code so far: class FilterToggle(ToggleButton): def __init__(self, **kwargs): Window.bind(mouse_pos=self.on_mouse_pos) super(FilterToggle, self).__init__(**kwargs) def on_mouse_pos(self, *args): pos = args[1] if self.collide_point(*pos): print("I am on the good path!) Here is my .kv file: <FilterToggle>: text_size: self.width - 20, None valign: 'middle' halign: 'left' markup: True . . . FilterToggle: text: "This is just to illustrate" The on_mouse_pos(

Retrieving MySQL with Kivy

淺唱寂寞╮ 提交于 2019-11-30 18:54:59
问题 I have a Kivy code, where the output is: I want to get replace the Box No. with strings retrieved from MySQL So far I have tried to implement the MySQL to the python script: class RemoveScreen(MyLayout): def __init__(self,**kwargs): db = MySQLdb.connect("localhost", "root", "[PASSWORD]", "tcs_microrage_crm") cursor=db.cursor() self.var = StringVar() self.label1 = Label(self, text=0, textvariable=self.var) myvar=str(self.var) #http://stackoverflow.com/questions/775296/python-mysql

How to make circular progress bar in kivy?

邮差的信 提交于 2019-11-29 07:50:44
I thought to make one simple circular progress bar using kivy and python. I searched online documentation and GitHub repertoires, but not found single proper example explaining the concept of circular progress bar . Like the image attached below. I thought to develop. Please anyone help me in this issue. New, better version This post has received much more attention than I expected, therefore I've decided to put a little bit of effort into creating an upgraded version of this widget. It is now available on GitHub . Here is a sample of what can be done with it (the progress bars are actually

Kivy: Unknown class <ListView> error code

旧巷老猫 提交于 2019-11-28 11:47:55
This is the main.py from kivy.app import App class WeatherApp(App): pass if __name__ == '__main__': WeatherApp().run() weather.kv is: AddLocationForm: <AddLocationForm@BoxLayout>: orientation: 'vertical' BoxLayout: TextInput: Button: text: "Search" Button: text: "Current Location" ListView: item_strings: ["Palo Alto, MX", "Palo Alto, US"] It doesn't seem to recognize listview. I have seen other use listview with "from kivy.uix.listview import ListView" but that doesn't work either, i do not know why. kivy.factory.FactoryException: Unknown class Kivy ListView » Deprecated ListView is no longer

Kivy: Unknown class <ListView> error code

倖福魔咒の 提交于 2019-11-27 22:42:17
问题 This is the main.py from kivy.app import App class WeatherApp(App): pass if __name__ == '__main__': WeatherApp().run() weather.kv is: AddLocationForm: <AddLocationForm@BoxLayout>: orientation: 'vertical' BoxLayout: TextInput: Button: text: "Search" Button: text: "Current Location" ListView: item_strings: ["Palo Alto, MX", "Palo Alto, US"] It doesn't seem to recognize listview. I have seen other use listview with "from kivy.uix.listview import ListView" but that doesn't work either, i do not

How can I make a lot of buttons at dynamic in kv language?

℡╲_俬逩灬. 提交于 2019-11-27 19:12:35
问题 I want to make a lot of Buttons at dynamic in kv language. But now I cannot...... I will show now source under this. BoxLayout: orientation: 'vertical' pos: root.pos size: root.size GridLayout: rows: 2 spacing: 5 padding: 5 Button: text: "X0" on_press: root.X(0) Button: text: "X1" on_press: root.X(1) I want to make like under code BoxLayout: orientation: 'vertical' pos: root.pos size: root.size GridLayout: rows: 2 spacing:5 padding:5 for i Button: text: "X#{i}" on_press: root.X(i) How can I

How to fetch data from database and show in table in kivy+python

生来就可爱ヽ(ⅴ<●) 提交于 2019-11-27 07:55:18
list.py import kivy kivy.require('1.9.0') # replace with your current kivy version ! import sqlite3 as lite from kivy.uix.screenmanager import Screen from kivy.app import App from kivy.lang import Builder from kivy.uix.boxlayout import BoxLayout from kivy.core.window import Window Window.clearcolor = (0, 0.517, 0.705, 1) Window.size = (500, 330) from easygui import msgbox con = lite.connect('demo.db') con.text_factory = str cur = con.cursor() class TestScreen(Screen): pass def get_user(self): cur.execute("SELECT * FROM `user` order by id asc") self.rows = cur.fetchall() print(self.rows) class