In this article we are going to learn about wx.GetBatteryState() which is a inbuilt parent function present in wxPython. GetBatteryState() returns battery state as one of BATTERY_NORMAL_STATE, BATTERY_LOW_STATE, BATTERY_CRITICAL_STATE, BATTERY_SHUTDOWN_STATE or BATTERY_UNKNOWN_STATE .
BATTERY_UNKNOWN_STATE is also the default on platforms where this feature is not implemented (currently everywhere but MS Windows).
Syntax: wx.GetBatteryState()
Parameters: No parameters
Return Type: wx.BatteryState
Code Example:
import wx
class Example(wx.Frame):
def __init__( self , * args, * * kwargs):
super (Example, self ).__init__( * args, * * kwargs)
self .InitUI()
def InitUI( self ):
self .locale = wx.Locale(wx.LANGUAGE_ENGLISH)
print (wx.GetBatteryState())
def main():
app = wx.App()
ex = Example( None )
ex.Show()
app.MainLoop()
if __name__ = = '__main__' :
main()
|
Output:
1
which is wx.BATTERY_LOW_STATE.
Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape,
GeeksforGeeks Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out -
check it out now!
Last Updated :
15 Jun, 2020
Like Article
Save Article