[Tutor] Data persistence problem

2013-06-20 Thread Arijit Ukil
I have following random number generation function def rand_int (): rand_num = int(math.ceil (random.random()*1000)) return rand_num I like to make the value of rand_num (return of rand_int) static/ unchanged after first call even if it is called multiple times. If x= rand_int () return

Re: [Tutor] How to redirect console output to a TextEdit box on a QT Python Gui ?

2013-06-20 Thread SM
Thanks, much, Ramit. On Wed, Jun 19, 2013 at 4:44 PM, Prasad, Ramit wrote: > SM wrote: > > Hello Chris, Thanks for your response. I have a follow-up question, if > you don't mind, to understand > > your answer better. > > I am running a python3 script. So first part of your answer applies > her

[Tutor] Writing logfile data to a user opened file

2013-06-20 Thread Matt D
Hey guys! So now my UI panel works well with this: # Open file button click event binded to openfile btn = wx.Button(self, -1, "Click me") sizer.Add(btn, pos=(7,2)) btn.Bind(wx.EVT_BUTTON, self.openFile) #set the panel layout self.SetSizer

[Tutor] Playing with XML

2013-06-20 Thread Danilo Chilene
Hello, Below is my code: #!/bin/env python # -*- coding: utf-8 -*- import requests from lxml import etree url = 'http://192.168.0.1/webservice.svc?wsdl' headers = {'Content-Type': 'text/xml;charset=UTF-8', 'SOAPAction': ' http://tempuri.org/ITService/SignIn'} xml = '''http://schemas.xmlsoap.org/

Re: [Tutor] Best Code testing practice?

2013-06-20 Thread Mark Lawrence
On 20/06/2013 12:43, Matt D wrote: Hey guys! Is there a fast way test some piece of code? I would like to be able to look at the GUI I am making with out changing the file in dir 'baz' and running the actual program (which is quite extensive). Like if I could just have a .py file with only the

Re: [Tutor] Best Code testing practice?

2013-06-20 Thread Alan Gauld
On 20/06/13 16:11, Matt D wrote: right make a small sample app. exactly. im sorry if im dense or whatever and obviously i am super new to this process. but i can write the scripts in gedit and then what? how do i run that file and make the gui start? should i be doing something like this?:

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 computations done in C++. The cod

Re: [Tutor] Best Code testing practice?

2013-06-20 Thread Oscar Benjamin
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 computations done in C++. The code for > 'tab', or wxPanel really, i am using is in

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 with out changing the file in dir 'baz

Re: [Tutor] Best Code testing practice?

2013-06-20 Thread Alan Gauld
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 with out changing the file in dir 'baz' In general your GUI should not be tied into one partic

[Tutor] Best Code testing practice?

2013-06-20 Thread Matt D
Hey guys! Is there a fast way test some piece of code? I would like to be able to look at the GUI I am making with out changing the file in dir 'baz' and running the actual program (which is quite extensive). Like if I could just have a .py file with only the smallest amount of code possible to m

Re: [Tutor] Opinion - help could use more examples

2013-06-20 Thread Alan Gauld
On 20/06/13 03:38, Steven D'Aprano wrote: On 20/06/13 10:21, Devin Jeanpierre wrote: they're doing -- it omits things like advice to do with security, including neglecting to declare that functions are not safe and can execute arbitrary Python code, I think it is perfectly acceptable for th