Close Menu
    Trending
    • Deploy a Streamlit App to AWS
    • How to Ensure Reliability in LLM Applications
    • Automating Deep Learning: A Gentle Introduction to AutoKeras and Keras Tuner
    • From Equal Weights to Smart Weights: OTPO’s Approach to Better LLM Alignment
    • The Future of AI Agent Communication with ACP
    • Vad världen har frågat ChatGPT under 2025
    • Google’s generative video model Veo 3 has a subtitles problem
    • MedGemma – Nya AI-modeller för hälso och sjukvård
    ProfitlyAI
    • Home
    • Latest News
    • AI Technology
    • Latest AI Innovations
    • AI Tools & Technologies
    • Artificial Intelligence
    ProfitlyAI
    Home » Mobile App Development with Python | Towards Data Science
    Artificial Intelligence

    Mobile App Development with Python | Towards Data Science

    ProfitlyAIBy ProfitlyAIJune 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 software for cell gadgets, akin to smartphones and tablets. Typically, cell apps are more durable to develop than internet apps, as a result of they have to be designed from scratch for every platform, whereas internet growth shares widespread codes throughout completely 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). As an 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 techniques.

    Cellular App Growth is very related for AI because it allows the mixing of latest applied sciences into folks each day life. LLMs are so widespread now as a result of they’ve been deployed into user-friendly apps in your telephone, simply accessible anytime and wherever.

    By means of this tutorial, I’ll clarify construct a cross-platform cell 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 package deal for cell apps, whereas KivyMD is the library that leverages Google’s Material Design and makes the utilization of this framework a lot simpler (much like Bootstrap for internet dev).

    ## for growth
    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:

    • essential.py (the title have to be this) which shall include the Python code of the app, mainly the back-end
    • parts.kv (you possibly can name it otherwise) which shall include all of the Kivy code used for the app structure, you possibly can see it because the front-end

    Then, within the essential.py file we import the package deal 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 reality, I’m utilizing it to memorize Chinese language vocabulary.

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

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

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

    As a way to embody Kivy file within the app, we have to load it from the essential.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
    
    class App(MDApp):
       def construct(self):        
           self.theme_cls.theme_style = "Gentle"        
           return Builder.load_file("parts.kv")
    
    class IntroScreen(Display):    
       go 
    
    class HomeScreen(Display):    
       go 
    
    class PlayScreen(Display):
       go  
     
    class SaveScreen(Display):    
       go 
    
    class EditScreen(Display):
       go
    
    if __name__ == "__main__":    
       App().run()

    Please word that even when the app itself is primary, there’s a fairly tough characteristic: db administration through cell. That’s why we’re going to use additionally the native Python package deal for databases:

    import sqlite3

    Growth — fundamentals

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

    I contemplate that straightforward as a result of it doesn’t require any Python code, it may be dealt with by the parts.kv file. The change of display screen triggered by the button have to be linked to the basis like this:

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

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

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

    Growth — superior

    Let’s step up our recreation and take care of the DB by way of the Save Display. It should permit the person to avoid wasting completely different phrases for various classes (i.e. to review a number of languages). That means: 

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

    Once you run the app for the primary time, the DB have to be created. We are able to do this in the primary perform of the app. For comfort, I’m going so as to add additionally one other perform that queries the DB with any SQL you go 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("parts.kv")

    The tough half is the DB icon that, when pushed, exhibits all the prevailing classes and permits the choice of one. Within the parts.kv file, underneath the Save Display (named “save”), we add an icon button (named “category_dropdown_save”) that, if pressed, launches the Python dropdown_save() perform from the primary app.

    That perform is outlined within the essential.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 screen supervisor calls the display screen with get_screen() and identifies the merchandise by id:

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

    class SaveScreen(Display):    
       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 avoid wasting the shape (by pushing the button).

    As a way to ensure that the perform 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 to this point, I’m assured that you just’re capable of undergo the complete code and perceive what’s happening. 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 without having a bodily iOS machine.

    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 resolve your app title and use it to create the repository, then open the .xcodeproj file:

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

    Lastly, if you’re working with iOS and also you wish to take a look at an app in your telephone 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 reveal design and construct a cross-platform cell app with Python. I used Kivy to design the person interface and I confirmed make it out there for iOS gadgets. Now you may make your personal cell 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 initiatives.

    👉 Let’s Connect 👈

    (All photos, until in any other case famous, are by the creator)



    Source link

    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email
    Previous ArticleHave a damaged painting? Restore it in just hours with an AI-generated “mask” | MIT News
    Next Article Photonic processor could streamline 6G wireless signal processing | MIT News
    ProfitlyAI
    • Website

    Related Posts

    Artificial Intelligence

    Deploy a Streamlit App to AWS

    July 15, 2025
    Artificial Intelligence

    How to Ensure Reliability in LLM Applications

    July 15, 2025
    Artificial Intelligence

    Automating Deep Learning: A Gentle Introduction to AutoKeras and Keras Tuner

    July 15, 2025
    Add A Comment
    Leave A Reply Cancel Reply

    Top Posts

    Fine-Tuning vLLMs for Document Understanding

    May 5, 2025

    Undetectable AI’s Writing Style Replicator vs. ChatGPT

    June 27, 2025

    There and Back Again: An AI Career Journey

    July 14, 2025

    An anomaly detection framework anyone can use | MIT News

    May 28, 2025

    AI stirs up trouble in the science peer review process

    April 4, 2025
    Categories
    • AI Technology
    • AI Tools & Technologies
    • Artificial Intelligence
    • Latest AI Innovations
    • Latest News
    Most Popular

    Transforming Healthcare with Generative AI: Key Benefits & Applications

    May 1, 2025

    Netflix Adds ChatGPT-Powered AI to Stop You From Scrolling Forever

    May 8, 2025

    AI Is Breaking the Hiring Process. And No One’s Ready

    July 1, 2025
    Our Picks

    Deploy a Streamlit App to AWS

    July 15, 2025

    How to Ensure Reliability in LLM Applications

    July 15, 2025

    Automating Deep Learning: A Gentle Introduction to AutoKeras and Keras Tuner

    July 15, 2025
    Categories
    • AI Technology
    • AI Tools & Technologies
    • Artificial Intelligence
    • Latest AI Innovations
    • Latest News
    • Privacy Policy
    • Disclaimer
    • Terms and Conditions
    • About us
    • Contact us
    Copyright © 2025 ProfitlyAI All Rights Reserved.

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