0

I'm developing an APP and I'm using Kivy, I need to get a user input that's an int/float but I can't get the input as I don't know how to get it, I've read the documentation, went through numerous Stackoverflow and Reddit threads.

This is the code

from kivy.app import App
from kivy.uix.label import Label
import psutil
import os
from kivy.uix.textinput import TextInput




class BatteryPrototypeApp(App):
    def build(self):

        battery = psutil.sensors_battery()
        plugged = battery.power_plugged
        percent = str(battery.percent)
        plugged = "Plugged In" if plugged else "Not Plugged In"
        
        # limit = int(input("Limite: "))
        label = Label(text=percent+'%')


        limit = TextInput(text='Limit')
        if battery.percent >= limit:
            os.system("start Alarm.mp3")
        
        
        return label
    

app = BatteryPrototypeApp()

app.run()
  • Try looking at [How to ask user for integer input using Python tkinter](https://stackoverflow.com/questions/72417465/how-to-ask-user-for-integer-input-using-python-tkinter). – Alias Cartellano Aug 07 '23 at 20:36

0 Answers0