473,395 Members | 1,791 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

how to create a button that is connected with many frames

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 1506

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

Similar topics

1
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...
12
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 ----------------------------------------------------------------------------...
3
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...
4
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...
4
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...
3
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...
7
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....
8
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...
3
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...
6
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
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,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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...
0
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...
0
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,...

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.