473,573 Members | 2,538 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

WXPYTHON push button call a frame

Hi I need to call a widget from a button in WXPYTHON. I've tried to
this from a function like this, but when push the button, the program
opens a window and do error.
Any idea?

......
def DialogRRHH(self ,event):
prog = wx.PySimpleApp( 0)
wx.InitAllImage Handlers()
DialogRRHH = MTRRHH(None, -1, "")
prog.SetTopWind ow(DialogRRHH)
DialogRRHH.Show ()
prog.MainLoop()

class MTRRHH(wx.Frame ):
........
if __name__ == "__main__":
app = wx.PySimpleApp( 0)
wx.InitAllImage Handlers()
tasques = tasques(None, -1, "")
app.SetTopWindo w(tasques)
tasques.Show()
app.MainLoop()

Jul 5 '07 #1
4 1864
Marcpp wrote:
Hi I need to call a widget from a button in WXPYTHON. I've tried to
this from a function like this, but when push the button, the program
opens a window and do error.
Any idea?
Well, one *really* good idea would be to copy the error message and
paste it into your message. The readers of this list have amazing
psychic powers, but you can always help improve the answer quality by
providing relevant information.
.....
def DialogRRHH(self ,event):
prog = wx.PySimpleApp( 0)
wx.InitAllImage Handlers()
DialogRRHH = MTRRHH(None, -1, "")
prog.SetTopWind ow(DialogRRHH)
DialogRRHH.Show ()
prog.MainLoop()

class MTRRHH(wx.Frame ):
.......
if __name__ == "__main__":
app = wx.PySimpleApp( 0)
wx.InitAllImage Handlers()
tasques = tasques(None, -1, "")
app.SetTopWindo w(tasques)
tasques.Show()
app.MainLoop()
Unfortunately your code extracts don't tell us what's going wrong, only
how the program is constructed. While that *is* useful information, by
itself it only paints half the picture.

regards
Steve
--
Steve Holden +1 571 484 6266 +1 800 494 3119
Holden Web LLC/Ltd http://www.holdenweb.com
Skype: holdenweb http://del.icio.us/steve.holden
--------------- Asciimercial ------------------
Get on the web: Blog, lens and tag the Internet
Many services currently offer free registration
----------- Thank You for Reading -------------

Jul 5 '07 #2
On 5 jul, 14:51, Steve Holden <s...@holdenweb .comwrote:
Marcpp wrote:
Hi I need to call a widget from a button in WXPYTHON. I've tried to
this from a function like this, but when push the button, the program
opens a window and do error.
Any idea?

Well, one *really* good idea would be to copy the error message and
paste it into your message. The readers of this list have amazing
psychic powers, but you can always help improve the answer quality by
providing relevant information.
.....
def DialogRRHH(self ,event):
prog = wx.PySimpleApp( 0)
wx.InitAllImage Handlers()
DialogRRHH = MTRRHH(None, -1, "")
prog.SetTopWind ow(DialogRRHH)
DialogRRHH.Show ()
prog.MainLoop()
class MTRRHH(wx.Frame ):
.......
if __name__ == "__main__":
app = wx.PySimpleApp( 0)
wx.InitAllImage Handlers()
tasques = tasques(None, -1, "")
app.SetTopWindo w(tasques)
tasques.Show()
app.MainLoop()

Unfortunately your code extracts don't tell us what's going wrong, only
how the program is constructed. While that *is* useful information, by
itself it only paints half the picture.

regards
Steve
--
Steve Holden +1 571 484 6266 +1 800 494 3119
Holden Web LLC/Ltd http://www.holdenweb.com
Skype: holdenweb http://del.icio.us/steve.holden
--------------- Asciimercial ------------------
Get on the web: Blog, lens and tag the Internet
Many services currently offer free registration
----------- Thank You for Reading -------------
Hi, the problem is No Error message, but the program continues running
after I closed it (by the X).

Jul 5 '07 #3
On Jul 5, 9:04 am, Marcpp <mar...@gmail.c omwrote:
On 5 jul, 14:51, Steve Holden <s...@holdenweb .comwrote:
Marcpp wrote:
Hi I need to call a widget from a button in WXPYTHON. I've tried to
this from a function like this, but when push the button, the program
opens a window and do error.
Any idea?
Well, one *really* good idea would be to copy the error message and
paste it into your message. The readers of this list have amazing
psychic powers, but you can always help improve the answer quality by
providing relevant information.
.....
def DialogRRHH(self ,event):
prog = wx.PySimpleApp( 0)
wx.InitAllImage Handlers()
DialogRRHH = MTRRHH(None, -1, "")
prog.SetTopWind ow(DialogRRHH)
DialogRRHH.Show ()
prog.MainLoop()
class MTRRHH(wx.Frame ):
.......
if __name__ == "__main__":
app = wx.PySimpleApp( 0)
wx.InitAllImage Handlers()
tasques = tasques(None, -1, "")
app.SetTopWindo w(tasques)
tasques.Show()
app.MainLoop()
Unfortunately your code extracts don't tell us what's going wrong, only
how the program is constructed. While that *is* useful information, by
itself it only paints half the picture.
regards
Steve
--
Steve Holden +1 571 484 6266 +1 800 494 3119
Holden Web LLC/Ltd http://www.holdenweb.com
Skype: holdenweb http://del.icio.us/steve.holden
--------------- Asciimercial ------------------
Get on the web: Blog, lens and tag the Internet
Many services currently offer free registration
----------- Thank You for Reading -------------

Hi, the problem is No Error message, but the program continues running
after I closed it (by the X).
When I open a custom frame from one of my applications, I do something
like this:
<main app code>

def BtnEventHandler (self, event):
frame = myFrame()
frame.Show()

</main app code>
<myframe code>

class myFrame(wx.Fram e):
def __init__(self, filename=None):
wx.Frame.__init __(self, None, -1, 'Whatever', size=(570,295))
# you can set the OnTop style here
# lots of other code...

def OnClose(self, event):
# Close the frame
self.Close()

</myframe code>

If you have additional problems, try mailing the wxPython group, which
you can find here: www.wxpython.org

Mike

Jul 5 '07 #4
Marcpp schreef:
Hi I need to call a widget from a button in WXPYTHON. I've tried to
this from a function like this, but when push the button, the program
opens a window and do error.
Any idea?

.....
def DialogRRHH(self ,event):
prog = wx.PySimpleApp( 0)
wx.InitAllImage Handlers()
DialogRRHH = MTRRHH(None, -1, "")
prog.SetTopWind ow(DialogRRHH)
DialogRRHH.Show ()
prog.MainLoop()

class MTRRHH(wx.Frame ):
.......
if __name__ == "__main__":
app = wx.PySimpleApp( 0)
wx.InitAllImage Handlers()
tasques = tasques(None, -1, "")
app.SetTopWindo w(tasques)
tasques.Show()
app.MainLoop()
In DialogRRHH() you create a new application object with a new event
loop, while you already have one running. wxPython should have only one
application object though; otherwise there conflicts between the
different event loops. Also you don't need to call
wx.InitAllImage Handlers() again.

It seems to me that in DialogRRHH() you want to create a dialog and wait
until the user closes it. In that case, it should look more or less like
this (beware, I'm not a wxPython expert myself):

def DialogRRHH(self , event):
DialogRRHH = MTRRHH(None, -1, "")
DialogRRHH.Show Modal()

Also, in that case MTRRHH should be a wxDialog, not a wxFrame.

In case you want to show MTRRHH without waiting for the user to close
it, use DialogRRHH.Show () instead of .ShowModal(). I think MTRRHH can be
either a wxDialog or a wxForm in that case.

--
If I have been able to see further, it was only because I stood
on the shoulders of giants. -- Isaac Newton

Roel Schroeven
Jul 5 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

19
3407
by: Grant Edwards | last post by:
I've decided to learn wxPython, and I'm afraid I just don't grok the whole "id" thing where you have to pull unique integers out of your, er, the air and then use those to refer to objects: From whe wxPython wiki examples: self.button =wxButton(self, 10, "Save", wxPoint(200, 325)) EVT_BUTTON(self, 10, self.OnClick)
15
2889
by: Grant Edwards | last post by:
Can anybody recommend a good book on wxPython? Are there any books on wxPython? I've been trying to learn wxPython and/or wax for a few weeks, and I'm just not getting it. wxWindows seems to be more low-level than the other GUI toolkits I've used (Tk, GTK, and Trestle), and there are all sorts exposed details in wxWindows/wxPython...
3
7529
by: Lo?c Mah? | last post by:
Hello I try to use a Validator for a TxtCtrl placed in a Panel with a Button in order to trigger the Validator and test the content of TxtCtrl. I have looked into wxPython documentation and demo and searched in google, but I am still unsuccessful yet. My problem is that I do not manage to call the Validate() method of my Validator from...
1
2149
by: mdk.R | last post by:
Hello all: i'am installed wxPython 2.5 and Python2.3.4..i try execute script with wxPython but it show error: Traceback (most recent call last): File "E:\py\test.py", line 7, in ? import wx File "E:\py\wx.py", line 10, in ? from wxPython.wx import * File "D:\Python23\Lib\site-package import _wx
0
1366
by: plumpy321 | last post by:
Hi, I took an example from wxPython with the IE web browser and created a refresh button to automatically refresh a web page in 5 second intervals. But I notice that the memory utilization in Python keeps increasing over time. Can anyone tell me why this is happening? Here is my code: ...
3
3206
by: John Salerno | last post by:
I'm using the sample code of the file 'simple.py' and trying to make a single window with a panel in it, but I keep getting an error. Here's my code: (I know I might need something else, like a Show() method for the panel, but the error stops on the first panel line anyway. I've tried a Layout() method but it didn't get that far). import wx...
9
5518
by: zxo102 | last post by:
Hi everyone, I am using a python socket server to collect data from a socket client and then control a image location ( wxpython) with the data, i.e. moving the image around in the wxpython frame. But the "app.MainLoop()" in wxpython looks like conflicting with the "while 1:" in socket server. After I commented the "app.MainLoop()",...
9
4408
by: Tyler | last post by:
Hello All: I am currently working on a project to create an FEM model for school. I was thinking about using wxPython to gather the 12 input variables from the user, then, after pressing the "Run" button, the GUI would close, and the 12 input variables would then be available for the rest of the program. So far, what I have been able to...
4
2840
by: Jimmy | last post by:
hi, all I'm having a problem with creating custom events in wxpython. I have a class A handling some data processing work and another class B of GUI matter. I need GUI to display information when data in A is updated. I know cutom events in wxpython may work. But I found no material paricularly helpful :(
0
7661
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7978
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8167
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...
1
7730
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
8028
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...
0
6349
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...
1
5550
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3688
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
987
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...

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.