get duplicate frames when doing multiprocessing

Yodash <[email protected]> Sun, 4 Apr 2021 09:39:39 -0700 (PDT)
Newsgroups gmane.comp.python.wxpython
Message-ID <[email protected]>
Hello
i'm trying to speed up my data load from pandas dataframe using 
multiprocessing
*my problem is that when i do multiprocessing from wx.frame , I 
surprisingly get duplicates of my frame* -* as the number of processes i'm 
trying to use*
(*no matter what method i use*...Pool/Pool.apply_sync 
or Process(target=f_action,) 

it doesn't happen all the time

for example..this code will duplicate the frame 3 times:
i'm trying to speed up my data load from pandas dataframe using 
multiprocessing
i call the code from EVENT_BUTTON of the frame


import multiprocessing as mp
import time,sys,os,wx
import pandas as pd

def  load_data  (file): 
    df=pd.read_csv(file[0])    
    return df

class DefaultFrame(wx.Frame):
    def __init__(self):
        """Constructor"""
        wx.Frame.__init__(self, None, title="Default Frame")
        panel = wx.Panel(self)
        
        button = wx.Button(panel, wx.ID_ANY, 'Test', (10, 10))
        button.Bind(wx.EVT_BUTTON, self.onButton)
        self.Show()

    def onButton( self,event):
    
             pool = mp.Pool(processes=3)
             input=[['data_m1.csv'],\
                        ['data_m1.csv'],\
                        ['data_m1.csv']]
            
             data=  pool .map(load_data, input)
         
       
if __name__ == "__main__":
    app = wx.App(False)
    frame = DefaultFrame()
    app.MainLoop() 

any ideas how can i multiprocess from a frame?

thanks :)
Yodash     
        
        
       
        

-- 
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/wxpython-users/ebceb553-f8f5-4597-bc93-67f119cf9f42n%40googlegroups.com.