[Tutor] Opensource projects / Subversion

2012-04-08 Thread mjolewis
Hey everyone,

I finally made my way into working on Opensource projects. I installed 
tortoisesvn. I included command line tools when running the installer. However 
when I invoke svn at command line, I get the following error:

"svn: command not found"

It seems like svn isn't installed, but again, I had the installer include 
command line tools. 

Please help. 

Sent from my iPhone
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Opensource projects / Subversion

2012-04-08 Thread Steven D'Aprano

mjole...@gmail.com wrote:

Hey everyone,

I finally made my way into working on Opensource projects. I installed 
tortoisesvn. I included command line tools when running the installer. However 
when I invoke svn at command line, I get the following error:

"svn: command not found"

It seems like svn isn't installed, but again, I had the installer include command line tools. 

Please help. 


Does this have anything to do with learning Python? What's tortoisesvn? Since 
you're having a problem with that, shouldn't you be asking on a tortoisesvn 
mailing list?




--
Steven

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Opensource projects / Subversion

2012-04-08 Thread Tim Golden

On 08/04/2012 16:07, Steven D'Aprano wrote:

mjole...@gmail.com wrote:

Hey everyone,

I finally made my way into working on Opensource projects. I installed
tortoisesvn. I included command line tools when running the installer.
However when I invoke svn at command line, I get the following error:

"svn: command not found"

It seems like svn isn't installed, but again, I had the installer
include command line tools.
Please help.


Does this have anything to do with learning Python? What's tortoisesvn?
Since you're having a problem with that, shouldn't you be asking on a
tortoisesvn mailing list?


As Steven points out, this is more to do with installing particular
development tools that with learning Python. However...

TortoiseSVN is a popular Windows Shell extension offering easy
access to Subversion via Windows Explorer. Although its
installers have, for a long time, only offered Shell (in the
Windows sense) access to the Subversion functions, more recent
installers have offered to install the commandline svn tools as well.

Since I have the commandline tools already installed, I've
never actually selected this option when upgrading to newer
versions. So what I don't know is whether they also add a
suitable directory to the PATH environment variable. But, given
the message you're getting, I imagine they don't.

I suspect that they would install to somewhere like:

  %PROGRAMFILES%\TortoiseSvn\bin

You can confirm that by cut-and-pasting that into your Start > Run
menu or into an Explorer address bar and seeing if it comes up
with a directory or not. If not, you'll have to scout around in
likely places to see where it *has* installed svn.exe and its
friends. Once you find them, add that directory to the PATH via:

  Control Panel > System > Advanced > Environment Variables

depending somewhat on what setup you're running. And then try again
at the command prompt with svn.

Alternatively, don't bother with the command prompt; just use
TortoiseSvn natively, so to speak.

TJG
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] regex question

2012-04-08 Thread Wayne Werner

On Fri, 6 Apr 2012, Khalid Al-Ghamdi wrote:


hi all,
I'm trying to extract the domain in the following string. Why doesn't my 
pattern (patt) work:

>>> redata
'Tue Jan 14 00:43:21 2020::eax...@gstwyysnbd.gov::1578951801-6-10 Sat Jul 31 
15:17:39 1993::rz...@wgxvhx.com::744121059-5-6 Mon Sep 21 20:22:37
1987::ttw...@rpybrct.edu::559243357-6-7 Fri Aug  2 07:15:23 
1991::t...@mgfyitsks.net::681106523-4-9 Mon Mar 18 19:59:47 
2024::dgz...@fhyykji.org::1710781187-6-7 '
>>> patt=r'\w+\.\w{3}(?<=@)'
>>> re.findall(patt,redata)
[]

This pattern works but the first should, too. shouldn't it?


The all too familiar quote looks like it applies here: "Often programmers, 
when faced with a problem, think 'Aha! I'll use a regex!'. Now you have 
two problems."


It looks like you could easily split this string with redata.split('::') 
and then look at every second element in the list and split *that* element 
on the last '.' in the string.


With data as well-formed as this, regex is probably overkill.

HTH,
Wayne
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


[Tutor] Calling Classes From Tkinter Radio Buttons

2012-04-08 Thread Nathan
I'm using Tkinter for a GUI for a program of mine, and I'm trying to
use radio buttons to select different functions, but it's not working
right at all. Originally, I had something like

class ClassOne(self):

def ___str___(self):
return "This is the base class."

class ClassTwo(ClassOne):

def __str__(self):
return "This is the derived class."

in, say, classes.py, and something like

import classes
from Tkinter import *

class Application(Frame):

def __init__(self, master):
Frame.__init__(self, master)
self.grid()
self.widgets()

LabelText = classes.ClassOne()

def widgets(self):
ClassLabel = Label(self, text = self.LabelText)
ClassLabel.grid()

root = Tk()
app = Application(root)
root.mainloop()

in, say, GUI.py. This works perfectly fine, but it only sets the label
as "This is the base class." What I'd like is a way to use radio
buttons to configure the text of ClassLabel so that the user can
choose between the two classes.

Currently, I'm trying changing GUI.py to something like:

import classes
from Tkinter import *

class Application(Frame):

def __init__(self, master):
Frame.__init__(self, master)
self.grid()
self.widgets()

LabelText = classes.ClassOne()
classes = ["ClassOne", "ClassTwo"]

def widgets(self):
self.variable = IntVar()
ClassLabel = Label(self, text = self.LabelText)
ClassLabel.grid(row = 0)
ClassOneButton = Radiobutton(self, text = "This selects the
base class.", variable = self.variable, value = 0, command =
self.ChangeClass)
ClassOneButton.grid(row = 1, column = 0)
ClassTwoButton = Radiobutton(self, text = "This selects the
derived class.", variable = self.variable, value = 1, command =
self.ChangeClass)
ResetButton = Button(self, text = "Reset the label", command =
self.ResetLabel)

def ResetLabel(self):
self.ClassLabel.configure(text = LabelText)

def ChangeClass(self):
self.selection = self.variable.get()  # This should get the
value of the selected radio button, right?
self.LabelText = self.classes[self.selection]() # LabelText
changes according to the radio button.

root = Tk()
app = Application(root)
root.mainloop()


... but when I run this, BOTH radio buttons are selected, and it still
just gives me the base class. What am I doing wrong? Is there a way to
first call a class with a radio button, and then reconfigure the label
with that class? Any help that can be offered is appreciated!
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Calling Classes From Tkinter Radio Buttons

2012-04-08 Thread Alan Gauld

On 08/04/12 23:26, Nathan wrote:

I'm using Tkinter for a GUI for a program of mine, and I'm trying to
use radio buttons to select different functions,


Sorry, its too late for my brain to try and decipher your code (even 
though you have tried to shorten it!).


But you can see a simple example of radio button usage in the case study 
topic of my tutorial...


HTH
--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] regex question

2012-04-08 Thread kaifeng jin
I think you can do this:
a=[]
b=redata.split('::')
for e in b:
if e.find('@') != -1:
a.append(e.split('@')[1])

list a includes all the domain

在 2012年4月9日 上午5:26,Wayne Werner 写道:

> On Fri, 6 Apr 2012, Khalid Al-Ghamdi wrote:
>
>  hi all,
>> I'm trying to extract the domain in the following string. Why doesn't my
>> pattern (patt) work:
>>
>> >>> redata
>> 'Tue Jan 14 00:43:21 2020::eax...@gstwyysnbd.gov::**1578951801-6-10 Sat
>> Jul 31 15:17:39 1993::rz...@wgxvhx.com::**744121059-5-6 Mon Sep 21
>> 20:22:37
>> 1987::ttw...@rpybrct.edu::**559243357-6-7 Fri Aug  2 07:15:23
>> 1991::t...@mgfyitsks.net::**681106523-4-9 Mon Mar 18 19:59:47
>> 2024::dgz...@fhyykji.org::**1710781187-6-7 '
>> >>> patt=r'\w+\.\w{3}(?<=@)'
>> >>> re.findall(patt,redata)
>> []
>>
>> This pattern works but the first should, too. shouldn't it?
>>
>
> The all too familiar quote looks like it applies here: "Often programmers,
> when faced with a problem, think 'Aha! I'll use a regex!'. Now you have two
> problems."
>
> It looks like you could easily split this string with redata.split('::')
> and then look at every second element in the list and split *that* element
> on the last '.' in the string.
>
> With data as well-formed as this, regex is probably overkill.
>
> HTH,
> Wayne
>
> ___
> Tutor maillist  -  Tutor@python.org
> To unsubscribe or change subscription options:
> http://mail.python.org/mailman/listinfo/tutor
>
>


-- 
twitter:@zybest 
新浪微博:@爱子悦 
在openshift上搭建wordpress:http://blog-mking.rhcloud.com/
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


[Tutor] Game of python, help please.

2012-04-08 Thread leo degon
Hello all, Im trying to learn python and programming in my free time, and
I'm trying to do a little personal project to trying and gain some skills.
Im trying to do version of John conways game of life. I have a working
version of the game. Written for 3.2.2 on a mac to be accessed through
terminal. I'm trying to give it a number of options. it dimensions, the max
number of turns, initial set up, and boundary conditions. The dimensions
and turns were pretty easy to include. The boundary conditions more
difficult, and now I'm getting stuck on the initial set up options. I can
set it up randomly but Im having problems implementing a checker board
pattern.


'''displays: the text of the game of life for a set number of X x Y for a
set of R turns.

[-][-][-][-][-]
[-][-][-][-][-]
[-][-][-][-][-]
[-][-][-][-][-]
[-][-][-][-][-]

Get X,Y,T, Initial value

Create a data space X x Y
Assign initial value
print initial value and the text' initial value'

do while turns

iam.py
Description: Binary data
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor