Python Forum
how to create python modal forms - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: how to create python modal forms (/thread-7600.html)



how to create python modal forms - shaun - Jan-17-2018

I am brand new to Python and I need some help with modality. I would like to set up an application say codeA.py screen with some buttons that call other python forms codeB.py, codeC.py etc. I need to know how codeA.py would call these (either codeB.py, codeC.py etc.) in a modal state and also how I could pass data back to codeA.py. I have found at the following statements that I loaded into codeA.py
import os 
os.system('python codeB.py'

from subprocess import Popen
Popen('python codeB.py')

from subprocess import call
call(["python", "codeB.py"]) )
which do open the codeB.py form but it needs to be modal and neither of these statements seem to allow for return data.

Can anyone suggest how this could be done with some example coding?

Shaun.


RE: how to create python modal forms - sparkz_alot - Jan-17-2018

Provided they are located in the same directory

codeA.py
import codeB
import codeC



RE: how to create python modal forms - shaun - Jan-17-2018

Thanks for that but this is not calling codeB.py or codeC.py in a modal state. This is what I need to do as the form Can be closed down etc while codeB.py or codeC.py is still active.


RE: how to create python modal forms - hshivaraj - Jan-17-2018

Quote:I need to know how codeA.py would call these (either codeB.py, codeC.py etc.)
There are many ways how you can call another python module. It depends what your trying to achieve from calling an another module. Calling in using os.system or by using multiprocessing module do all the same things.

The question to ask, what is the intention of calling those module? What do you want from the calling module to return. That is, are you expecting some value in codeA from codeB and are expecting to process the return value in codeA?

Quote: This is what I need to do as the form Can be closed down etc while codeB.py or codeC.py is still active.
If this case, I think there's serious design issue here.