New" to create a new (duplicate) window of current form" /> New" to create a new (duplicate) window of current form">

How to use "File->New" to create a new (duplicate) window of current form

Heads up! You've already completed this tutorial.

Cody_Jackson | 2020-12-29 21:00:43 UTC | #1

I've found the Qt documentation for QFileDialog and similar things, but all the references I've found discuss opening existing files or saving your current file. I haven't found anything that states how to actually create a new file, i.e. a new instance of your application.

I'm creating a character record sheet for a game. Since it's possible for one person to have multiple characters, especially if the game master wants to have many NPCs, having the ability to use File->New Character would be useful.

In summary, if the application is open with a character sheet, how would I call the code to create a new character sheet? I am using PyQt5 and the character sheet is created w/ QtDesigner.


Over 10,000 developers have bought Create GUI Applications with Python & Qt!
Create GUI Applications with Python & Qt6
Take a look

Downloadable ebook (PDF, ePub) & Complete Source code

Also available from Leanpub and Amazon Paperback

[[ discount.discount_pc ]]% OFF for the next [[ discount.duration ]] [[discount.description ]] with the code [[ discount.coupon_code ]]

Purchasing Power Parity

Developers in [[ country ]] get [[ discount.discount_pc ]]% OFF on all books & courses with code [[ discount.coupon_code ]]
Well done, you've finished this tutorial! Mark As Complete
[[ user.completed.length ]] completed [[ user.streak+1 ]] day streak
Martin Fitzpatrick

How to use "File->New" to create a new (duplicate) window of current form was written by Martin Fitzpatrick .

Martin Fitzpatrick has been developing Python/Qt apps for 8 years. Building desktop applications to make data-analysis tools more user-friendly, Python was the obvious choice. Starting with Tk, later moving to wxWidgets and finally adopting PyQt. Martin founded PythonGUIs to provide easy to follow GUI programming tutorials to the Python community. He has written a number of popular Python books on the subject.