473,326 Members | 2,133 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,326 software developers and data experts.

How close program in the wxPython?

I have made a program in wxpython, but how could i exit the program? I
am using wxFrame for my window, what is the function to close the
program?

Thanks!!

Jul 19 '05 #1
3 7287

"Tian" <wa*********@gmail.com> ha scritto nel messaggio
news:11**********************@z14g2000cwz.googlegr oups.com...
I have made a program in wxpython, but how could i exit the program? I
am using wxFrame for my window, what is the function to close the
program?

Thanks!!


Wich version of wx? You cannot exit the program clicking "x" in the top
right of the win?
TO exit you can also bind the EVT_CLOSE event.....

F.P.
Jul 19 '05 #2
The Great 'Tian' uttered these words on 5/2/2005 2:00 PM:
I have made a program in wxpython, but how could i exit the program? I
am using wxFrame for my window, what is the function to close the
program?

Thanks!!


Tian,

See below:

--- CloseDemo.pyw ----

import wx

class MainFrame(wx.Frame):
def __init__(self, parent, id, title, size, pos,\
style=wx.DEFAULT_FRAME_STYLE|wx.NO_FULL_REPAINT_ON _RESIZE):
wx.Frame.__init__(self, parent, id, title, size, pos, style)
# Bind close event here
self.Bind(wx.EVT_CLOSE, self.OnCloseWindow)
self.Show(True)

#OnCloseWindow is executed when EVT_CLOSE is received

def OnCloseWindow(self, evt):
print 'OnCloseWindow() called'
#Do other clean up action
#and destroy frame
self.Destroy()

app = wx.PySimpleApp()
frame = MainFrame(None, -1, "Test Close Event", (-1,-1), (-1,-1))
app.MainLoop()

----------------------

Hope that helped.

Thanks,
-Kartic
Jul 19 '05 #3
I know how to capture window close event, but what i want to do is to
close window using commands. now i am simply using "sys.exit()" to
close the whole program. but it seems that window close events will are
be generated in this case. is there any function in wxpython that i can
use to close application window, yet generate the windows close event?

Jul 19 '05 #4

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

Similar topics

4
by: ulysses | last post by:
hi, I'm working in python 5 months. I think it's very cool language. I do a p2p python program GUI. First I make a software by wxpython. But I find wxpython use many many memory. Second I use...
0
by: Steve Ingram | last post by:
Hiya, I've got a problem with a program I've written and want to distribute. It uses a wxPython dialog and I've built a distribution version with py2exe. Problem is when I run the .exe under...
0
by: Steve Ingram | last post by:
Found out what I'd done, and it wasn't py2exe causug the problem. I wasn't closing the main dialog properly, I was calling Close() instead of Destroy(), so the dialog stayed in memory, basically it...
1
by: Jim Langston | last post by:
Windows. Situation: Using a Python program called OpenRPG. I have a program that displays form data (a character sheet) in C++. I am able in the C++ program to build a string and copy it into the...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.