Python Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming LanguagesPython Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old May 1st, 2004, 06:12 AM
flixxer flixxer is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2004
Posts: 44 flixxer User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 5
Exchanging value,data etc.

This one is kind of complicated to me, the main point is to exchange value between frames and windows (wxPython)

I make a connection from a Frame1, then I will have another Dialog window that will do some FTP processing, like showing a list of files on the server, but how could I make a connection make on Frame1 to work with the Dialog?

Here an example:

Code:
Frame one:
 from ftplib import FTP

 self.ftp = FTP()# make a connection  


Code:
Dialog:
 list = self.ftp.nlst() #it should use the connection make on Frame1.
 self.txt.WriteText(list)

Reply With Quote
  #2  
Old May 1st, 2004, 06:33 AM
DevCoach DevCoach is offline
Contributing User
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Feb 2004
Location: London, England
Posts: 1,221 DevCoach User rank is Captain (20000 - 30000 Reputation Level)DevCoach User rank is Captain (20000 - 30000 Reputation Level)DevCoach User rank is Captain (20000 - 30000 Reputation Level)DevCoach User rank is Captain (20000 - 30000 Reputation Level)DevCoach User rank is Captain (20000 - 30000 Reputation Level)DevCoach User rank is Captain (20000 - 30000 Reputation Level)DevCoach User rank is Captain (20000 - 30000 Reputation Level)DevCoach User rank is Captain (20000 - 30000 Reputation Level)DevCoach User rank is Captain (20000 - 30000 Reputation Level) 
Time spent in forums: 1 Week 5 Days 22 h 21 m 4 sec
Reputation Power: 263
One of the parameters to the dialog __init__ method is the parent object, which in your case I presume will be Frame one. You can get the ftp object from that:

Code:
class MyDialog(wxDialog):
  def __init__(self, parent, id, *args, **kwargs):
     wxDialog.__init__(self, parent, -1, 'myDialogTitle', *args, **kwargs)
     self.ftp = parent.ftp



Alternatively you could pass the ftp or list object as an extra parameter to the __init__ method:

Code:
class MyDialog(wxDialog):
  def __init__(self, parent, *args, **kwargs):
     self.list = kwargs.pop('list', [])    #Python 2.3 onwards
     wxDialog.__init__(self, parent, -1, 'myDialogTitle', *args, **kwargs)
     self.ftp = parent.ftp


in this example the 'list' object must be passed as a keyword parameter.

Dave - The Developers' Coach

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPython Programming > Exchanging value,data etc.


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway
Stay green...Green IT