473,770 Members | 1,700 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

how to create a button that is connected with many frames

1 New Member
please correct my code using boa constructor

------------frame1---------------
Expand|Select|Wrap|Line Numbers
  1. #Boa:Frame:Frame1
  2.  
  3. import wx
  4. import Frame2
  5. import Frame3
  6.  
  7.  
  8. def create(parent):
  9.     return Frame1(parent)
  10.  
  11. [wxID_FRAME1, wxID_FRAME1BUTTON1, wxID_FRAME1BUTTON2, wxID_FRAME1PANEL1, 
  12. ] = [wx.NewId() for _init_ctrls in range(4)]
  13.  
  14. class Frame1(wx.Frame):
  15.     def _init_coll_boxSizer1_Items(self, parent):
  16.         # generated method, don't edit
  17.  
  18.         parent.AddWindow(self.panel1, 1, border=0, flag=wx.EXPAND)
  19.  
  20.     def _init_sizers(self):
  21.         # generated method, don't edit
  22.         self.boxSizer1 = wx.BoxSizer(orient=wx.VERTICAL)
  23.  
  24.         self._init_coll_boxSizer1_Items(self.boxSizer1)
  25.  
  26.         self.SetSizer(self.boxSizer1)
  27.  
  28.     def _init_ctrls(self, prnt):
  29.         # generated method, don't edit
  30.         wx.Frame.__init__(self, id=wxID_FRAME1, name='', parent=prnt,
  31.               pos=wx.Point(512, 326), size=wx.Size(400, 257),
  32.               style=wx.DEFAULT_FRAME_STYLE, title='Frame1')
  33.         self.SetClientSize(wx.Size(392, 223))
  34.  
  35.         self.panel1 = wx.Panel(id=wxID_FRAME1PANEL1, name='panel1', parent=self,
  36.               pos=wx.Point(0, 0), size=wx.Size(392, 223),
  37.               style=wx.TAB_TRAVERSAL)
  38.  
  39.         self.button1 = wx.Button(id=wxID_FRAME1BUTTON1, label='button1',
  40.               name='button1', parent=self.panel1, pos=wx.Point(168, 88),
  41.               size=wx.Size(75, 23), style=0)
  42.         self.button1.Bind(wx.EVT_BUTTON, self.OnButton1, id=wxID_FRAME1BUTTON1)
  43.  
  44.         self.button2 = wx.Button(id=wxID_FRAME1BUTTON2, label='button2',
  45.               name='button2', parent=self.panel1, pos=wx.Point(184, 136),
  46.               size=wx.Size(75, 23), style=0)
  47.         self.button2.Bind(wx.EVT_BUTTON, self.OnButton2, id=wxID_FRAME1BUTTON2)
  48.  
  49.         self._init_sizers()
  50.  
  51.     def __init__(self, parent):
  52.         self._init_ctrls(parent)
  53.  
  54.     def OnButton1(self, event):
  55.         self.main = Frame2.create(None)
  56.         self.main.Show()
  57.         self.Hide()
  58.  
  59.     def OnButton2(self, event):
  60.         self.main = Frame3.create(None)
  61.         self.main.Show()
  62.         self.Hide()

-----------------frame2--------------
Expand|Select|Wrap|Line Numbers
  1. #Boa:Frame:Frame2
  2.  
  3. import wx
  4.  
  5. def create(parent):
  6.     return Frame2(parent)
  7.  
  8. [wxID_FRAME2, wxID_FRAME2BUTTON1, wxID_FRAME2PANEL1, 
  9. ] = [wx.NewId() for _init_ctrls in range(3)]
  10.  
  11. class Frame2(wx.Frame):
  12.     def _init_coll_boxSizer1_Items(self, parent):
  13.         # generated method, don't edit
  14.  
  15.         parent.AddWindow(self.panel1, 1, border=0, flag=wx.EXPAND)
  16.  
  17.     def _init_sizers(self):
  18.         # generated method, don't edit
  19.         self.boxSizer1 = wx.BoxSizer(orient=wx.VERTICAL)
  20.  
  21.         self._init_coll_boxSizer1_Items(self.boxSizer1)
  22.  
  23.         self.SetSizer(self.boxSizer1)
  24.  
  25.     def _init_ctrls(self, prnt):
  26.         # generated method, don't edit
  27.         wx.Frame.__init__(self, id=wxID_FRAME2, name='Frame2', parent=prnt,
  28.               pos=wx.Point(530, 253), size=wx.Size(400, 257),
  29.               style=wx.DEFAULT_FRAME_STYLE, title='Frame2')
  30.         self.SetClientSize(wx.Size(392, 223))
  31.  
  32.         self.panel1 = wx.Panel(id=wxID_FRAME2PANEL1, name='panel1', parent=self,
  33.               pos=wx.Point(0, 0), size=wx.Size(392, 223),
  34.               style=wx.TAB_TRAVERSAL)
  35.  
  36.         self.button1 = wx.Button(id=wxID_FRAME2BUTTON1, label=u'frame1',
  37.               name='button1', parent=self.panel1, pos=wx.Point(48, 160),
  38.               size=wx.Size(75, 23), style=0)
  39.         self.button1.Bind(wx.EVT_BUTTON, self.OnButton1, id=wxID_FRAME2BUTTON1)
  40.  
  41.         self._init_sizers()
  42.  
  43.     def __init__(self, parent):
  44.         self._init_ctrls(parent)
  45.         self.parent = parent
  46.  
  47.     def OnButton1(self, event):
  48.         self.main = Frame1.create(None)
  49.         self.main.Show()
  50.         self.Hide()
--------------frame3--------------
Expand|Select|Wrap|Line Numbers
  1. #Boa:Frame:Frame3
  2.  
  3. import wx
  4.  
  5. def create(parent):
  6.     return Frame3(parent)
  7.  
  8. [wxID_FRAME3, wxID_FRAME3BUTTON1, wxID_FRAME3PANEL1, 
  9. ] = [wx.NewId() for _init_ctrls in range(3)]
  10.  
  11. class Frame3(wx.Frame):
  12.     def _init_coll_boxSizer1_Items(self, parent):
  13.         # generated method, don't edit
  14.  
  15.         parent.AddWindow(self.panel1, 1, border=0, flag=wx.EXPAND)
  16.  
  17.     def _init_sizers(self):
  18.         # generated method, don't edit
  19.         self.boxSizer1 = wx.BoxSizer(orient=wx.VERTICAL)
  20.  
  21.         self._init_coll_boxSizer1_Items(self.boxSizer1)
  22.  
  23.         self.SetSizer(self.boxSizer1)
  24.  
  25.     def _init_ctrls(self, prnt):
  26.         # generated method, don't edit
  27.         wx.Frame.__init__(self, id=wxID_FRAME3, name='', parent=prnt,
  28.               pos=wx.Point(552, 276), size=wx.Size(400, 250),
  29.               style=wx.DEFAULT_FRAME_STYLE, title='Frame3')
  30.         self.SetClientSize(wx.Size(392, 216))
  31.  
  32.         self.panel1 = wx.Panel(id=wxID_FRAME3PANEL1, name='panel1', parent=self,
  33.               pos=wx.Point(0, 0), size=wx.Size(392, 216),
  34.               style=wx.TAB_TRAVERSAL)
  35.  
  36.         self.button1 = wx.Button(id=wxID_FRAME3BUTTON1, label=u'frame1',
  37.               name='button1', parent=self.panel1, pos=wx.Point(192, 80),
  38.               size=wx.Size(75, 23), style=0)
  39.         self.button1.Bind(wx.EVT_BUTTON, self.OnButton1Button,
  40.               id=wxID_FRAME3BUTTON1)
  41.  
  42.         self._init_sizers()
  43.  
  44.     def __init__(self, parent):
  45.         self._init_ctrls(parent)
  46.         self.parent = parent
  47.  
  48.     def OnButton1(self, event):
  49.         pos = self.GetPosition()
  50.         self.parent.Move(pos)
  51.         self.parent.Show()
  52.         self.Hide()

-----------------app1---------------
Expand|Select|Wrap|Line Numbers
  1. #!/usr/bin/env python
  2. #Boa:App:BoaApp
  3.  
  4. import wx
  5.  
  6. import Frame1
  7. import Frame2
  8.  
  9. modules ={'Frame1': [0, 'Main frame of Application', u'Frame1.py'], 
  10.     'Frame2': [1, 'second frame of Application', u'Frame2.py'],
  11.     'Frame3': [2, 'third frame of Application', u'Frame3.py']}
  12.  
  13. class BoaApp(wx.App):
  14.     def OnInit(self):
  15.         self.main = Frame1.create(None)
  16.         self.main.Show()
  17.         self.SetTopWindow(self.main)
  18.         return True
  19.  
  20. def main():
  21.     application = BoaApp(0)
  22.     application.MainLoop()
  23.  
  24. if __name__ == '__main__':
  25.     main()
thanks for answer
Mar 27 '10 #1
0 1520

Sign in to post your reply or Sign up for a free account.

Similar topics

1
4855
by: Jawahar Rajan | last post by:
All, I have an ASP site that uses frames two frames. (yes I should be using include files, but we started ou using frames so we have been stuck with frames.) When I get a page expired warning (I am not caching pages) and a user clicks refresh from the menu bar the user is taken back to the home page! The home page is a frame with a top frame that is repeated on each subsequent asp pages
12
9802
by: Javier | last post by:
Hello, I'm very new in this forum and as I have the following problem, the website is in http://new.vanara.com ---------------------------------------------------------------------------- -------------------------------------------- Here's how the site works: You should press a button in the rollover area in order to load a source file on an Iframe, this Iframe is actually hidden working as a Buffer. The body of this loaded Iframe is...
3
1585
by: Rajagopal | last post by:
Hi, I have one main page where i have 3 frames. From main page i will open some other report page by clicking on a button. Now if i click the Internet Explorer Back button then it is not showing me the main page which has 3 frames. Please let me know how i can resolve this. Thanks,
4
8875
by: PiedmontBiz | last post by:
Greetings I have written an online survey with 110 questions. I use javascript to cycle thru all the questions which are displayed in an iframe. I keep track of the question number using a "global" variable. When testing it, everything works fine until I hit the back button. The iframe goes to the previous question, but of course, the counter is not decremented. Example if I am at question # 5 and I hit the back button, I go to #4,...
4
4836
by: Miguel Dias Moura | last post by:
Hello, I created a datalist in an ASP.Net / VB page. I display the image and price of a few products. When a user clicks an image I want to load the page "detail.aspx?number=id" and send the value of the "id" field of that record as a URL parameter. Can someone tell me how to do this.
3
1461
by: mailto.anand.hariharan | last post by:
Hello group. This is my first message in this group, and my first stab at Javascript. I am trying to tweak the code for the "FOLDOC button" (http://foldoc.org/foldoc/tools.html) to be able to execute a DB query over my firm's intra-net. The source code for the IE button is as follows:
7
3242
by: Roemer | last post by:
Hi all I stumbled over a new problem: I have a programm with just a class that is asynchronous listening for network connections. As soon as someone connected, a new form needs to be created. The Form gets created but hangs after creation. I'ts logical that that happens because the new Form doesn't get a Message Loop. The Message Loop is created on Application.Run() on the Main Method on the Main Thread. The Callback is (normally)...
8
2051
by: Richard Maher | last post by:
Hi, I am in a mouseup event for button A and I'd like to disable=false button B before starting some work. Is there anyway that an event for button B can then fire before my event processing for button A's mouseup has completed? I beleive event processing to be single-threaded for good reason but I need a "stop" button and it's no good if it doesn't do anything until the other processing has finished :-)
3
5262
by: Beamer | last post by:
Hi I am trying to build a roating slide effect in javascript. Basically, I have a list like below <ul id="slideShowCnt"> <li id="slide0"><img .../></li> <li id="slide0"><img .../></li> <li id="slide0"><img .../></li> <li id="slide0"><img .../></li> <li id="slide0"><img .../></li> <li id="slide0"><img .../></li>
6
3540
by: mcl | last post by:
I have a domain name which is set up for web forwarding with a frame. I have a link on one of the site's pages to an external site. When I select the link the external site is displayed correctly with its own URL in the address bar. When I select the <backbutton in the browser, my domain name appears temporarily in the browser, but it returns to the external site. If I look at back History (In Firefox) there are two entries for my...
0
9602
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10071
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9882
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8905
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6690
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5326
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5467
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3987
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2832
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.