LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 07-26-2005, 08:37 AM   #1
mulciber
Member
 
Registered: Feb 2005
Location: OH
Distribution: Trying to decide
Posts: 55

Rep: Reputation: 15
python gui file dialog question


I have the following python code:
Code:
import re
import sys

prt = raw_input("Enter file to open: ")
all_the_data = open(prt,'rb').read()
pattern = 'title="(.*?)".*?value="(.*?)"'
rx = re.compile(pattern, re.IGNORECASE|re.MULTILINE|re.DOTALL)
result = rx.findall(all_the_data)

for title, value in result:
    print '%-25s: %s' %(title, value)

I want the code to be used when someone picks a file with the open dialog as such displaying the results to my text box "textEditor":
Code:
def OnMenuFileOpenMenu(self, event):
        dlg = wx.FileDialog(self, "Choose a file", ".", "", "*.prt", wx.OPEN)
        try:
            if dlg.ShowModal() == wx.ID_OK:
                filename = dlg.GetPath()
                self.textEditor.LoadFile(filename)
                self.FileName=filename
                self.SetTitle(('DCS File Log Viewer- %s') % filename)
                # process the file
        finally:
            dlg.Destroy()
The question is how do I do it? I have been unable to find any good examples thus far. I am using BOA for my development. Thanks!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
how to catch the return value of dialog without temp file ? doublehp Linux - Software 1 05-20-2005 11:52 PM
Python Question - moving file across filesystems drj000 Programming 3 01-26-2005 12:36 PM
java file dialog not case sensative. exodist Programming 3 12-31-2004 02:12 PM
python call function in same file(very newbie question) rmanocha Programming 2 11-21-2004 01:04 AM
python GUI problem~ black Programming 3 01-04-2004 09:35 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 01:25 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration