473,671 Members | 2,421 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 1867
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
3417
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
2899
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 that I find weird.
3
7535
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 the button handler.
1
2153
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
1373
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
3213
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 class MyFrame(wx.Frame):
9
5542
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()", everything is working except two things: 1. if I click anywhere on the screen with the mouse, the image is...
9
4425
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 do is mostly a reverse engineering job to get the frame to look right and return the text variable...
4
2846
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
8401
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8926
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. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8824
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...
1
8603
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 most users, this new feature is actually very convenient. If you want to control the update process,...
0
7444
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
4227
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
4416
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2818
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
2
1815
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.