Close Menu
    Trending
    • From Accidents to Actuarial Accuracy: The Role of Assumption Validation in Insurance Claim Amount Prediction Using Linear Regression | by Ved Prakash | Jun, 2025
    • I Wish Every Entrepreneur Had a Dad Like Mine — Here’s Why
    • Why You’re Still Coding AI Manually: Build a GPT-Backed API with Spring Boot in 30 Minutes | by CodeWithUs | Jun, 2025
    • New York Requiring Companies to Reveal If AI Caused Layoffs
    • Powering next-gen services with AI in regulated industries 
    • From Grit to GitHub: My Journey Into Data Science and Analytics | by JashwanthDasari | Jun, 2025
    • Mommies, Nannies, Au Pairs, and Me: The End Of Being A SAHD
    • Building Essential Leadership Skills in Franchising
    Finance StarGate
    • Home
    • Artificial Intelligence
    • AI Technology
    • Data Science
    • Machine Learning
    • Finance
    • Passive Income
    Finance StarGate
    Home»Artificial Intelligence»Mobile App Development with Python | Towards Data Science
    Artificial Intelligence

    Mobile App Development with Python | Towards Data Science

    FinanceStarGateBy FinanceStarGateJune 11, 2025No Comments8 Mins Read
    Share Facebook Twitter Pinterest LinkedIn Tumblr Reddit Telegram Email
    Share
    Facebook Twitter LinkedIn Pinterest Email


    Mobile App Development is the method of constructing an utility for cellular gadgets, equivalent to smartphones and tablets. Usually, cellular apps are more durable to develop than net apps, as a result of they should be designed from scratch for every platform, whereas net improvement shares widespread codes throughout totally different gadgets.

    Every working system has its personal language used for coding a native app (one created with know-how devoted to a particular platform). For example, Android makes use of Java, whereas iOS makes use of Swift. Normally, it’s higher to make use of the devoted tech for apps that require excessive efficiency, like gaming or heavy animations. Quite the opposite, hybrid apps use cross-platform languages (i.e. Python) that may be run on a number of working programs.

    Cellular App Growth is extremely related for AI because it permits the mixing of recent applied sciences into individuals day by day life. LLMs are so well-liked now as a result of they’ve been deployed into user-friendly apps in your cellphone, simply accessible anytime and wherever.

    Via this tutorial, I’ll clarify the right way to construct a cross-platform cellular app with Python, utilizing my Memorizer App for example (hyperlink to full code on the finish of the article).

    Setup

    I’m going to use the Kivy framework, which is the most used for mobile development in the Python community. Kivy is an open-source bundle for cellular apps, whereas KivyMD is the library that leverages Google’s Material Design and makes the utilization of this framework a lot simpler (just like Bootstrap for net dev).

    ## for improvement
    pip set up kivy==2.0.0
    pip set up kivymd==0.104.2
    
    ## for deployment
    pip set up Cython==0.29.27
    pip set up kivy-ios==1.2.1

    The very first thing to do is to create 2 recordsdata:

    • major.py (the identify should be this) which shall comprise the Python code of the app, principally the back-end
    • elements.kv (you may name it otherwise) which shall comprise all of the Kivy code used for the app structure, you may see it because the front-end

    Then, within the major.py file we import the bundle to initialize an empty app:

    from kivymd.app import MDApp
    
    class App(MDApp):
       def construct(self):        
           self.theme_cls.theme_style = "Gentle"        
           return 0
    
    if __name__ == "__main__":    
       App().run()

    Earlier than we begin, I shall briefly describe the applying I’m constructing. It’s a easy app that helps to memorize stuff: the person inserts pair of phrases (i.e. one thing in English and the equal in one other language, or a date and the historic occasion linked to that). Then, the person can play the sport by attempting to recollect shuffled info. As a matter of truth, I’m utilizing it to memorize Chinese language vocabulary.

    As you may see from the picture, I’m going to incorporate:

    • an intro display to show the brand
    • a house display that may redirect to the opposite screens
    • a display to save lots of phrases
    • a display to view and delete saved info
    • a display to play the sport.

    So, we are able to write all of them down within the elements.kv file:

    To be able to embody Kivy file within the app, we have to load it from the major.py with the builder class, whereas the screen class hyperlinks the screens between the 2 recordsdata.

    from kivymd.app import MDApp
    from kivy.lang import Builder
    from kivy.uix.screenmanager import Display screen
    
    class App(MDApp):
       def construct(self):        
           self.theme_cls.theme_style = "Gentle"        
           return Builder.load_file("elements.kv")
    
    class IntroScreen(Display screen):    
       move 
    
    class HomeScreen(Display screen):    
       move 
    
    class PlayScreen(Display screen):
       move  
     
    class SaveScreen(Display screen):    
       move 
    
    class EditScreen(Display screen):
       move
    
    if __name__ == "__main__":    
       App().run()

    Please word that even when the app itself is fundamental, there’s a fairly tough function: db administration through cellular. That’s why we’re going to use additionally the native Python bundle for databases:

    import sqlite3

    Growth — fundamentals

    We’re gonna heat up with the Intro Display screen: it merely comprises an image logo, some text labels, and a button to maneuver to a different display.

    I take into account that simple as a result of it doesn’t require any Python code, it may be dealt with by the elements.kv file. The change of display triggered by the button should be linked to the basis like this:

    The identical goes for the House Display screen: because it’s only a redirect, it may be all managed with Kivy code. You simply should specify that the display will need to have 1 icon and three buttons.

    You could have seen that on high of the display there’s a “dwelling” icon. Please word that there’s a distinction between a simple icon and an icon button: the latter is pushable. On this display it’s only a easy icon, however on the opposite screens it will likely be an icon button used to carry you again to the House Display screen from some other display of the app.

    Once we use an icon, now we have to supply the tag (i.e. “dwelling” shows somewhat home). I discover this code very helpful, simply run it and it’ll present all of the accessible icons.

    Growth — superior

    Let’s step up our sport and cope with the DB by the Save Display screen. It should permit the person to save lots of totally different phrases for various classes (i.e. to check a number of languages). That suggests: 

    • selecting an present class (i.e. Chinese language), so querying the present ones
    • creating a brand new class (i.e. French)
    • two textual content inputs (i.e. a phrase and its translation)
    • a button to save lots of the shape, so writing a brand new row within the DB.

    While you run the app for the primary time, the DB should be created. We will do this in the principle operate of the app. For comfort, I’m going so as to add additionally one other operate that queries the DB with any SQL you move on.

    class App(MDApp):
    
       def query_db(self, q, knowledge=False):        
           conn = sqlite3.join("db.db")        
           db = conn.cursor()        
           db.execute(q)        
           if knowledge is True:            
               lst_tuples_rows = db.fetchall()        
           conn.commit()        
           conn.shut()        
           return lst_tuples_rows if knowledge is True else None
    
       def construct(self):        
           self.theme_cls.theme_style = "Gentle"
           q = "CREATE TABLE if not exists SAVED (class textual content, left
                textual content, proper textual content, distinctive (class,left,proper))"      
           self.query_db(q)
           return Builder.load_file("elements.kv")

    The tough half is the DB icon that, when pushed, exhibits all the present classes and permits the collection of one. Within the elements.kv file, underneath the Save Display screen (named “save”), we add an icon button (named “category_dropdown_save”) that, if pressed, launches the Python dropdown_save() operate from the principle app.

    That operate is outlined within the major.py file and returns a dropdown menu such that, when an merchandise is pressed it will get assigned to a variable named “class”.

    That final line of code hyperlinks the class variable with the label that seems within the front-end. The display supervisor calls the display with get_screen() and identifies the merchandise by id:

    When the person enters the Save Display screen, the class variable must be null till one is chosen. We will specify the properties of the screen when one enters and when one leaves. So I’m going so as to add a operate within the display class that empties the App variable.

    class SaveScreen(Display screen):    
       def on_enter(self):        
           App.class = ''

    As soon as the class is chosen, the person can insert the opposite textual content inputs, that are required to save lots of the shape (by pushing the button).

    To be able to ensure that the operate doesn’t save if one of many inputs is empty, I’ll use a dialog box.

    from kivymd.uix.dialog import MDDialog
    
    class App(MDApp):    
      dialog = None     
      
      def alert_dialog(self, txt):        
         if not self.dialog:            
            self.dialog = MDDialog(textual content=txt)        
         self.dialog.open()        
         self.dialog = None
    
      def save(self):
         self.class = self.root.get_screen('save').ids.class.textual content  
              if self.class == '' else self.class            
         left = self.root.get_screen('save').ids.left_input.textual content            
         proper = self.root.get_screen('save').ids.right_input.textual content            
         if "" in [self.category.strip(), left.strip(), right.strip()]:                
              self.alert_dialog("Fields are required")            
         else:                
              q = f"INSERT INTO SAVED VALUES('{self.class}',
                    '{left}','{proper}')"                
              self.query_db(q)                
              self.alert_dialog("Saved")                  
              self.root.get_screen('save').ids.left_input.textual content = ''                
              self.root.get_screen('save').ids.right_input.textual content = ''                
              self.class = ''

    After studying thus far, I’m assured that you simply’re in a position to undergo the total code and perceive what’s occurring. The logic of the opposite screens is fairly related.

    Take a look at

    You possibly can take a look at the app on the iOS simulator on MacBook, that replicates an iPhone atmosphere with no need a bodily iOS system.

    Xcode must be put in. Begin by opening the terminal and working the next instructions (the final one will take about half-hour):

    brew set up autoconf automake libtool pkg-config
    
    brew hyperlink libtool
    
    toolchain construct kivy

    Now determine your app identify and use it to create the repository, then open the .xcodeproj file:

    toolchain create yourappname ~/some/path/listing
    
    open yourappname-ios/yourappname.xcodeproj

    Lastly, in case you are working with iOS and also you need to take a look at an app in your cellphone after which publish it on the App Retailer, Apple requires you to pay for a developer account.

    Conclusion

    This text has been a tutorial to show the right way to design and construct a cross-platform cellular app with Python. I used Kivy to design the person interface and I confirmed the right way to make it accessible for iOS gadgets. Now you can also make your personal cellular apps with Python and Kivy.

    Full code for this text: GitHub

    I hope you loved it! Be happy to contact me for questions and suggestions or simply to share your attention-grabbing tasks.

    👉 Let’s Connect 👈

    (All pictures, except in any other case famous, are by the writer)



    Source link

    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email
    Previous ArticleWriting docs for fast-paced technologies: Challenges and rewards | by Oshini Nugapitiya | Jun, 2025
    Next Article Take Control of What Your Online Presence Says About You
    FinanceStarGate

    Related Posts

    Artificial Intelligence

    Boost Your LLM Output and Design Smarter Prompts: Real Tricks from an AI Engineer’s Toolbox

    June 13, 2025
    Artificial Intelligence

    Connecting the Dots for Better Movie Recommendations

    June 13, 2025
    Artificial Intelligence

    Agentic AI 103: Building Multi-Agent Teams

    June 12, 2025
    Add A Comment
    Leave A Reply Cancel Reply

    Top Posts

    Custom Training Pipeline for Object Detection Models

    March 7, 2025

    Creating Business Value with AI — What I Learned from Cornell’s “Designing and Building AI Solutions” Program (Part 1) | by Aaron (Youshen) Lim | May, 2025

    May 9, 2025

    Por que prever a saída de colaboradores é essencial para a saúde financeira da empresa. | by William Irineu | Apr, 2025

    April 1, 2025

    Building A Neural Network from Scratch in Go | by Robert McMenemy | Feb, 2025

    February 23, 2025

    Hshsh

    February 9, 2025
    Categories
    • AI Technology
    • Artificial Intelligence
    • Data Science
    • Finance
    • Machine Learning
    • Passive Income
    Most Popular

    How I Built a Bird Identification App with OpenAI CLIP | by Operation Curiosity | Jun, 2025

    June 8, 2025

    How Likely Is a Six Nations Grand Slam in 2025? | by Harry Snart | Jan, 2025

    February 2, 2025

    Clustering of Popular Business Locations in San Francisco Bay Area Using K-Means | by Partha Das | May, 2025

    May 20, 2025
    Our Picks

    Did You Hear? You Can Get Apple’s MacBook Pro With a Touch Bar for More Than 70% Off.

    March 1, 2025

    Prescriptive Modeling Unpacked: A Complete Guide to Intervention With Bayesian Modeling.

    June 6, 2025

    A vision for U.S. science success | MIT News

    February 16, 2025
    Categories
    • AI Technology
    • Artificial Intelligence
    • Data Science
    • Finance
    • Machine Learning
    • Passive Income
    • Privacy Policy
    • Disclaimer
    • Terms and Conditions
    • About us
    • Contact us
    Copyright © 2025 Financestargate.com All Rights Reserved.

    Type above and press Enter to search. Press Esc to cancel.