[Tutor] Need Help Modifying a wxPython GUI (scrolling display and logging)

2013-06-03 Thread Matt D
the values. I need this log so the data can easily be worked on in excel or SAS. I need the time/date stamp for time series analysis. I attached the code behind the wxPythoin GUI I am using. Any help will be much appreciated. Thanks in advance -- Matt D #!/usr/bin/env python

Re: [Tutor] Need Help Modifying a wxPython GUI (scrolling display and logging)

2013-06-12 Thread Matt D
On 06/10/2013 12:23 PM, Prasad, Ramit wrote: > Matt D wrote: >> Ramit Prasad wrote: >>>>> Scrolled panel is just a graphical container that allows for scrolling >>>>> inside, >>>>> but it is the window that scrolls not widgets inside it. Th

Re: [Tutor] Need Help Modifying a wxPython GUI (scrolling display and logging)

2013-06-12 Thread Matt D
On 06/12/2013 05:59 PM, Dave Angel wrote: > On 06/12/2013 05:32 PM, Matt D wrote: >> On 06/10/2013 12:23 PM, Prasad, Ramit wrote: >>> Matt D wrote: >>>> Ramit Prasad wrote: >>>>>>> Scrolled panel is just a graphical container that allows for >

Re: [Tutor] Need Help Modifying a wxPython GUI (scrolling display and logging)

2013-06-12 Thread Matt D
> There are other ways a script might change the current directory. For > example, some naive scripts use os.chdir() > > But how is it you don't know what the current directory was when the > code ran? A simply pwd can tell you, if your prompt doesn't already > reveal it. > > hey i found the

[Tutor] Fwd: Re: Need Help Modifying a wxPython GUI (scrolling display and logging)

2013-06-12 Thread Matt D
Original Message Subject: Re: [Tutor] Need Help Modifying a wxPython GUI (scrolling display and logging) Date: Thu, 13 Jun 2013 00:17:44 -0400 From: Matt D To: Dave Angel On 06/12/2013 09:44 PM, Dave Angel wrote: > On 06/12/2013 09:23 PM, Matt D wrote: >> >

Re: [Tutor] Need Help Modifying a wxPython GUI (scrolling display and logging)

2013-06-12 Thread Matt D
On 06/12/2013 09:54 PM, Dave Angel wrote: > On 06/12/2013 09:14 PM, Matt D wrote: >> On 06/12/2013 09:02 PM, Dave Angel wrote: >>> On 06/12/2013 08:46 PM, Matt D wrote: >>>> On 06/12/2013 05:59 PM, Dave Angel wrote: >>>>> On 06/12/2013 05:32 P

Re: [Tutor] Need Help Modifying a wxPython GUI (scrolling display and logging)

2013-06-13 Thread Matt D
On 06/13/2013 03:39 AM, Alan Gauld wrote: > On 13/06/13 05:24, Matt D wrote: > >> I already told you i found the file? why would someone else be running >> the program? > > Because it does something useful? > Most pro programmers write programs for other people to us

Re: [Tutor] Fwd: Re: Need Help Modifying a wxPython GUI (scrolling display and logging)

2013-06-13 Thread Matt D
On 06/13/2013 08:22 AM, Dave Angel wrote: > On 06/13/2013 12:18 AM, Matt D wrote: >> >> >> >>> >>> >> yes the .py file has TextCtrl fields that get there values from a >> pickled dictionary. Another peice of the code watches a thread for the

Re: [Tutor] Fwd: Re: Need Help Modifying a wxPython GUI (scrolling display and logging)

2013-06-13 Thread Matt D
On 06/13/2013 11:23 AM, Dave Angel wrote: > On 06/13/2013 10:37 AM, Matt D wrote: >> On 06/13/2013 08:22 AM, Dave Angel wrote: >>> On 06/13/2013 12:18 AM, Matt D wrote: >>>> >>>> >>>> >>>>> >>>>> >>>

Re: [Tutor] Fwd: Re: Need Help Modifying a wxPython GUI (scrolling display and logging)

2013-06-14 Thread Matt D
i am trying to figure a way to to use a list to log/print my data: # tmplist = [time, 'nac', 'tgid', 'source', 'dest', 'algid'] is what we want tmplist = [] tmplist.append((str(strftime("%Y-%m-%d %H:%M:%S", localtime( tmplist.append(field_values["nac"]) tmplis

Re: [Tutor] Fwd: Re: Need Help Modifying a wxPython GUI (scrolling display and logging)

2013-06-14 Thread Matt D
im sorry i dont get it. there is too many brackets in this lin: tmplist.append(field_values["nac"]) Thats where the error is but i dont see too many brackets? On 06/14/2013 08:56 AM, Flynn, Stephen (L & P - IT) wrote: > Not enough closing brackets on the previous line... or actually too

Re: [Tutor] Fwd: Re: Need Help Modifying a wxPython GUI (scrolling display and logging)

2013-06-14 Thread Matt D
On 06/14/2013 10:27 AM, Alan Gauld wrote: > On 14/06/13 14:27, Matt D wrote: >> im sorry i dont get it. there is too many brackets in this lin: >> >> tmplist.append(field_values["nac"]) >> >> Thats where the error is > > No, that's where

Re: [Tutor] Fwd: Re: Need Help Modifying a wxPython GUI (scrolling display and logging)

2013-06-14 Thread Matt D
Hey, here is a snip of my code. #logger code-- # first new line #self.logfile.write('\n') # date and time #self.logfile.write('%s,'%(str(strftime("%Y-%m-%d %H:%M:%S", gmtime()

Re: [Tutor] Fwd: Re: Need Help Modifying a wxPython GUI (scrolling display and logging)

2013-06-14 Thread Matt D
On 06/14/2013 03:14 PM, Dave Angel wrote: > On 06/14/2013 10:48 AM, Matt D wrote: >> Hey, >> here is a snip of my code. >> >> #logger code-- >> # first new line >> #self.logfile.

[Tutor] Need help appending data to a logfile

2013-06-17 Thread Matt D
th trailing comma self.logfile.write('%s,'%(str(f))) self.logfile.write('\n') #end logger code In addition to not deleting the old data, it would be awesome to have some sort of wxPython widget that would give the user the ab

Re: [Tutor] Need Help Modifying a wxPython GUI (scrolling display and logging)

2013-06-18 Thread Matt D
> Everything Dave Angel said applies. > > You can sort the keys by doing and sorting the keys and then logging. > That should ensure field order. > > for k in sorted(self.fields): > v = self.fields[k] > > > Also note, that unless you do self.logfile.close() it is not guaranteed > that the d

Re: [Tutor] Need Help Modifying a wxPython GUI (scrolling display and logging)

2013-06-19 Thread Matt D
> A common way to trigger UI actions is a button whose callback calls that. > Or you can bind in an event hook for closing the window. > > in __init__ add this line - > self.Bind(wx.EVT_CLOSE, self.onExit) > > > def onExit(self, event): >'''Run when closing''' >self.logfile.close() >

[Tutor] Best Code testing practice?

2013-06-20 Thread Matt D
trying to find some way to do this. Thanks! -- Matt D ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Best Code testing practice?

2013-06-20 Thread Matt D
On 06/20/2013 08:52 AM, Alan Gauld wrote: > On 20/06/13 12:43, Matt D wrote: > >> Is there a fast way test some piece of code? > > There are several testing frameworks for testing Python code. > nose is one example. > But... > >> look at the GUI I am making

Re: [Tutor] Best Code testing practice?

2013-06-20 Thread Matt D
On 06/20/2013 10:49 AM, Oscar Benjamin wrote: > On 20 June 2013 15:32, Matt D wrote: >> all i really want to do is test the the GUI code. i am working on a >> 'tab' in a notebook of 7 tabs, which is itself part of a large python >> program which gets all of its

[Tutor] Writing logfile data to a user opened file

2013-06-20 Thread Matt D
maybe something in python like 'user_opened_file = logfile' or 'write logfile to user_opened_file'? I am not able to find standard way to do this. Cheers! -- Matt D ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Best Code testing practice?

2013-06-21 Thread Matt D
> > I suspect that you'd get better answers on a GUI specific mailing list, > like one for wxPython, but I note that you've already asked pretty much > the same question there. > Hey guys! Have decided that it is probably going to be better for my purposes to simply crack open a terminal, cd int

Re: [Tutor] Writing logfile data to a user opened file

2013-06-21 Thread Matt D
> > When you open a file the data should be written to that. If you want to > move existing data from logfile.txt into user opened file then you need > to read logfile.txt and then write it to the user opened file. To make > your life simpler, either pass in the file path or open the file save >

Re: [Tutor] Writing logfile data to a user opened file

2013-06-21 Thread Matt D
On 06/21/2013 04:44 PM, Prasad, Ramit wrote: > Matt D wrote: >> [Ramit P wrote:] >>> When you open a file the data should be written to that. If you want to >>> move existing data from logfile.txt into user opened file then you need >>> to read logfile.txt and t

Re: [Tutor] Writing logfile data to a user opened file

2013-06-21 Thread Matt D
> > You should really switch to the "with open() as f:" idiom I keep showing > you. This will automatically close the file for you. > it just occured to me to do this: def openFile(self, evt): with wx.FileDialog(self, "Choose a file", os.getcwd(), "", "*.tx

Re: [Tutor] Writing logfile data to a user opened file

2013-06-22 Thread Matt D
On 06/22/2013 03:47 AM, Alan Gauld wrote: > On 22/06/13 02:42, Matt D wrote: > >> if dlg.ShowModal() == wx.ID_OK: >> path = dlg.GetPath() >> mypath = os.path.basename(path) >>

[Tutor] Need help printing a pickled data

2013-06-24 Thread Matt D
I have been unable to find a way to write pickled data to text file. My last attempt was to add the last two lines: # the dataevent class -- stores the data that gets transmitted when the event occurs. #it is the data in text fields, stored in self.data as a dictionary, which is basically a c++ m

Re: [Tutor] Need help appending data to a logfile

2013-06-24 Thread Matt D
On 06/24/2013 05:57 PM, Dave Angel wrote: > On 06/24/2013 05:39 PM, Matt D wrote: >> >>> But what he's doing has nothing to do with logging. He's just using >>> that word. >>> >>> >> Right, I'm not doing a debugging thing. Ju

Re: [Tutor] Need help printing a pickled data

2013-06-24 Thread Matt D
On 06/24/2013 06:05 PM, Matt D wrote: > I have been unable to find a way to write pickled data to text file. > My last attempt was to add the last two lines: > > # the dataevent class -- stores the data that gets transmitted when the > event occurs. > #it is the data in text

Re: [Tutor] Need help printing a pickled data

2013-06-24 Thread Matt D
On 06/24/2013 07:17 PM, Alan Gauld wrote: > On 24/06/13 23:05, Matt D wrote: >> I have been unable to find a way to write pickled data to text file. > > Probably because pickled data is not plain text. > You need to use binary mode. However... > > >>

Re: [Tutor] Need help printing a pickled data

2013-06-25 Thread Matt D
On 06/25/2013 07:28 AM, eryksun wrote: > On Mon, Jun 24, 2013 at 6:57 PM, Steven D'Aprano wrote: >> >> You certainly shouldn't be writing pickle data to a log file! Firstly, >> log files are usually opened in text mode, not binary mode, so it >> probably won't work, and secondly even if it did wor

Re: [Tutor] Need help printing a pickled data

2013-06-25 Thread Matt D
> > with open('mypicklelog.txt','ab') as log: # open in binary mode > pickle.dump(self.data, log) # serialize data and write to file > > where pickle.dump(obj, file) converts `obj` to a sequence of bytes before it > is written to `file`. > I put this like this: class DataEvent(wx.PyEven

Re: [Tutor] Need help printing a pickled data

2013-06-25 Thread Matt D
> > Well I think self.data is some kind of container with a pickled string, > given the code to unpickle it is: > Exactly! This is what the C++ file 'pickle.h' creates to send to the Python GUI: /** * A pickled Python dictionary. Used to pass stuff to the UI. */ class pickle { public:

Re: [Tutor] Need help printing a pickled data

2013-06-25 Thread Matt D
On 06/25/2013 01:54 PM, Alan Gauld wrote: > On 25/06/13 17:32, Matt D wrote: > >> self.data = data >> with open('mypicklelog.txt','ab') as log: # open in binary mode >> pickle.dump(self.data, log) # serialize data a

Re: [Tutor] Need help printing a pickled data

2013-06-25 Thread Matt D
> > The real question is why do you want this pickle in a file? I am not sure > it will be easy to pull out and reuse anyway. Given your experience level, > I think this is a lot of work for something that you are unlikely to be able > to easily use. I think it would be more useful to `log.wr