Python Forum
how to create python modal forms
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
how to create python modal forms
#1
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.
Reply
#2
Provided they are located in the same directory

codeA.py
import codeB
import codeC
If it ain't broke, I just haven't gotten to it yet.
OS: Windows 10, openSuse 42.3, freeBSD 11, Raspian "Stretch"
Python 3.6.5, IDE: PyCharm 2018 Community Edition
Reply
#3
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.
Reply
#4
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.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  difference between forms of input a list to function akbarza 6 1,096 Feb-21-2024, 08:02 PM
Last Post: bterwijn
  2 forms of this tool grep command Lylyhannah 0 2,001 Jan-21-2019, 08:21 AM
Last Post: Lylyhannah
  Python with email forms, and frontend code in general MattH 4 3,440 Feb-18-2018, 03:29 AM
Last Post: MattH

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020