Image illustration python

What does make a smartphone app feel magical that a desktop app doesn’t have? To me it is the ability to remember the past. Lets add that to our PyQt apps!


In short : Use the QSetting object to save and reload the status of your app. Use the value method to fetch a value from your setting file, use the setValue method to save a variable.

The Built

Lets build an interface where the user needs to enter a message to send over a chat. To me the best way to make that app magical is to remember the typed message and reload it when we reopen the app.

Here is the basic of the app without any QSettings in it :

Now we will add 2 elements to that app :

  • A saving system when we change the text of the current pending message
  • A loading of the old value from the setting file (in the constructor)

The addition of those two bits of codes makes the app look like that:

That way when you open the app again your old message is still there. That is one of the ways I make my apps feel magical for the user. If you have other ways in mind, please share them in the comments.