473,327 Members | 1,896 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,327 software developers and data experts.

open file dialog box using wxglade

how to open a file dialog box using wxglade on clicking button??
Mar 31 '07 #1
7 8146
bartonc
6,596 Expert 4TB
how to open a file dialog box using wxglade on clicking button??
In the event handler attribute or the button, type the name of your event handler (say, OnOpenFileDialogButton). Then in the generated code find the
Expand|Select|Wrap|Line Numbers
  1.     def OnOpenFileDialogButton(self, event):
And add something like:
Expand|Select|Wrap|Line Numbers
  1.         filename = ""  # Use  filename as a flag
  2.         dlg = wx.FileDialog(self, message="Choose a file")
  3.  
  4.         if dlg.ShowModal() == wx.ID_OK:
  5.  
  6.             # get the new filename from the dialog
  7.             filename = dlg.GetPath()
  8.         dlg.Destroy()  # best to do this sooner than later
  9.  
  10.         if filename:
  11.             # use the file name
Apr 2 '07 #2
In the event handler attribute or the button, type the name of your event handler (say, OnOpenFileDialogButton). Then in the generated code find the
Expand|Select|Wrap|Line Numbers
  1.     def OnOpenFileDialogButton(self, event):
And add something like:
Expand|Select|Wrap|Line Numbers
  1.         filename = ""  # Use  filename as a flag
  2.         dlg = wx.FileDialog(self, message="Choose a file")
  3.  
  4.         if dlg.ShowModal() == wx.ID_OK:
  5.  
  6.             # get the new filename from the dialog
  7.             filename = dlg.GetPath()
  8.         dlg.Destroy()  # best to do this sooner than later
  9.  
  10.         if filename:
  11.             # use the file name
hey thanx a ton..its working!
Apr 3 '07 #3
bartonc
6,596 Expert 4TB
hey thanx a ton..its working!
You are welcome, a ton!
Apr 3 '07 #4
You are welcome, a ton!
hey after opening the file dialoq box..for opening any file what shud be the code..??
is it simple f=open("filename")???
Apr 3 '07 #5
bartonc
6,596 Expert 4TB
hey after opening the file dialoq box..for opening any file what shud be the code..??
is it simple f=open("filename")???
That should do it. You can
Expand|Select|Wrap|Line Numbers
  1. print filename
to see what the return value looks like.
Apr 3 '07 #6
That should do it. You can
Expand|Select|Wrap|Line Numbers
  1. print filename
to see what the return value looks like.
actually i want the file that is opened to show..like if it opens some new.txt then notepad shud open the file..is it possible??
Apr 4 '07 #7
bartonc
6,596 Expert 4TB
actually i want the file that is opened to show..like if it opens some new.txt then notepad shud open the file..is it possible??
You could read all the text and put it into a muli-line TextCtrl or start exploring the world of wx.Document class. The second option would give you things like saving changes and printing without much work. For simple display the fist option + TE_READ_ONLY is the best option.
Apr 4 '07 #8

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

Similar topics

7
by: Martin | last post by:
Again drawing on the groups experience:- 1. For general file opening and file saving, using VB6, are there any issues with using the FileOpen and FileSave Common Dialog Boxes? 2. Is using the...
2
by: Pilu | last post by:
hi,given that I'm a newbie in python, I have a little problem with wx... Maybe it's a stupid thing,but if u want help me! I used wxglade to generate a simple window with a button! wxglade...
0
by: Dune | last post by:
Hi there, I have an aspx page that allows users to enter several parameters using drop downs and text boxes. The users then press a button that produces an extract based on the parameters they...
4
by: Dorte | last post by:
Hi, I am using the code below to stream a CSV file with the response object. Dim FileName As String = "Test.csv" With Web.HttpContext.Current.Response ...
2
by: Mattbooty | last post by:
Hello, Not sure if anyone else has seen this bug, but I have a form where the entire form is covered with a picturebox. The picturebox has a mouseup event. I also have an open file dialog for...
2
by: crystalattice | last post by:
I'm making a GUI for a console-based program I just wrote. I figured it would be mostly straight forward to convert it over in wxPython but now I'm confused. In my console program, I have...
5
by: charles | last post by:
I have a question about the file Open dialog box. I would like to be able to make the dialog box bigger by selecting the bottom right-hand corner and dragging/expanding the box. I am told by...
7
by: Peter | last post by:
ASP.NET 2.0 I am trying to open a Word document and Excel document from a dialog web page, what's the best way to do that? I have tried the following: Response.Clear();...
5
by: Stefano Tonello | last post by:
Hi all, I need to call windows' "open with" dialog from my C# windows form application. After the user selects application, control must return to me (I have to launch directly the process). I...
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: 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...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
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
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
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.