Re: [Tutor] Set changing order of items?

2007-01-21 Thread Adam Cripps
On 1/20/07, Kent Johnson [EMAIL PROTECTED] wrote: Adam Cripps wrote: Many thanks all - I've got there in the end, using a tuple inside a set, ditching the question number and then rendering the sum for output in my main gui module. However, this does raise another issue now (which I had

Re: [Tutor] Set changing order of items?

2007-01-20 Thread Adam Cripps
On 1/20/07, Kent Johnson [EMAIL PROTECTED] wrote: Adam Cripps wrote: On 1/19/07, Simon Brunning [EMAIL PROTECTED] wrote: On 1/19/07, Adam Cripps [EMAIL PROTECTED] wrote: I'm adding strings to a Set to prevent duplicates. However, the strings are meant to be in the correct order. When I

[Tutor] Set changing order of items?

2007-01-19 Thread Adam Cripps
I'm adding strings to a Set to prevent duplicates. However, the strings are meant to be in the correct order. When I add the string to the Set, the order seems to change (and I don't seem to be able to predict what order they are in). The string is a simple addition question which should look

Re: [Tutor] Set changing order of items?

2007-01-19 Thread Adam Cripps
On 1/19/07, Simon Brunning [EMAIL PROTECTED] wrote: On 1/19/07, Adam Cripps [EMAIL PROTECTED] wrote: I'm adding strings to a Set to prevent duplicates. However, the strings are meant to be in the correct order. When I add the string to the Set, the order seems to change (and I don't seem

[Tutor] Removing duplicates in a list with a fixed length of items in the list.

2007-01-11 Thread Adam Cripps
I have a list which comprises of simple random arithmetic problems for teachers to give to their pupils. This list must be a set length (if the teacher asks for 10 questions, they should get 10 questions), but should not have any duplicates. I've seen the use of sets, but this reduces the size of

Re: [Tutor] Removing duplicates in a list with a fixed length of items in the list.

2007-01-11 Thread Adam Cripps
On 1/11/07, Adam Cripps [EMAIL PROTECTED] wrote: On 1/11/07, Kent Johnson [EMAIL PROTECTED] wrote: Adam Cripps wrote: I have a list which comprises of simple random arithmetic problems for teachers to give to their pupils. This list must be a set length (if the teacher asks for 10

[Tutor] Lists of lists - different sized lists

2006-05-19 Thread Adam Cripps
I'm trying to sort [1] a list of people randomly into groups. My guess is that a list of lists will do the trick here. However, the randrange fails with an empty range. How can I check for this? I thought that my pupils list wouldn't reach zero with the while len(pupils)0: would keep it above 0.

Re: [Tutor] Mysql BLOB strangeness?

2006-03-25 Thread Adam Cripps
On 3/19/06, Brian Gustin [EMAIL PROTECTED] wrote: OK so I guess you know what you need to do now :) something like this perhaaps : (modified your original code) reportlist = query(reportquery) mystring = 'p' for row in reportlist: id = row[0] title = row[1]

[Tutor] Cleaning up input before inserting into MySQL.

2006-03-25 Thread Adam Cripps
I have a textarea which collects text and other characters. I'm attempting to put this into a MySQL database. See code at [1]. However, if I use any type of quotes (either single or double) then it prematurely closes the SQL statement, and I get an errror: ProgrammingError: (1064, You have an

Re: [Tutor] html and mod_python

2006-03-22 Thread Adam Cripps
On 3/23/06, Patty [EMAIL PROTECTED] wrote: Hi! I created a form in a python file that takes values selected from 6 different drop down boxes: for target in all_targets: s = s + form action='process_info' method='POST' s = s + input type='hidden' name='tg' value=%s % target

Re: [Tutor] Mysql BLOB strangeness?

2006-03-19 Thread Adam Cripps
On 3/18/06, Brian Gustin [EMAIL PROTECTED] wrote: Oh. just found the original question.. :) OK perhaps this would be more helpful if you were to manually query mysql on command line and paste the results it outputs here. what I am betting is your method to get the data out of teh query is

Re: [Tutor] Mysql BLOB strangeness?

2006-03-18 Thread Adam Cripps
On 3/17/06, Brian Gustin [EMAIL PROTECTED] wrote: if the data is not binary, you can use TEXT type - accepts all readable characters and data, BLOB type is more for binary data storage, and MYSQL's Varchar type only stores up to 255 characters. (65,536 bits, or 64Kbits) If you are storing

[Tutor] Mysql BLOB strangeness?

2006-03-17 Thread Adam Cripps
I'm trying to build a mini-CMS for my class to manage a single webpage, using CGI and mysql. The children will be storing their main content in a BLOB within a Mysql database. When I query the content column, I get a strange return like this: array('c', 'This is a test ') - when the only text I

Re: [Tutor] Mysql BLOB strangeness?

2006-03-17 Thread Adam Cripps
On 3/17/06, Kent Johnson [EMAIL PROTECTED] wrote: Adam Cripps wrote: I'm trying to build a mini-CMS for my class to manage a single webpage, using CGI and mysql. The children will be storing their main content in a BLOB within a Mysql database. When I query the content column, I get

Re: [Tutor] Mysql BLOB strangeness?

2006-03-17 Thread Adam Cripps
On 3/17/06, Kent Johnson [EMAIL PROTECTED] wrote: Adam Cripps wrote: On 3/17/06, Kent Johnson [EMAIL PROTECTED] wrote: Why are you using a BLOB when the content is text? I'm using BLOB because I want them to be able to write content that is longer than 255 chars. I'm no MySQL expert

Re: [Tutor] Design suggestion - is a cookie the answer?

2006-01-17 Thread Adam Cripps
On 1/17/06, Alan Gauld [EMAIL PROTECTED] wrote: you are using GET instead of POST? GET is the default submission method but POST is nearly always better and should avoid the problem here. (I think, I haven't tried it!) I believe the python CGI module is submission-method agnostic

Re: [Tutor] Design suggestion - is a cookie the answer?

2006-01-15 Thread Adam Cripps
On 1/15/06, Simon Gerber [EMAIL PROTECTED] wrote: I'd recommend using client side JavaScript for this. Create a submit function in JavaScript that will only actually submit the form if all the questions have been completed. I'm sure this is implied in Alan's post, but I'm going to point

[Tutor] Design suggestion - is a cookie the answer?

2006-01-14 Thread Adam Cripps
I've developed a nice but simple cgi script [1] which produces multiplication questions for children in my class. It randomly presents a list of questions and then checks the answers once they push submit. The form builds up a fairly long list of vars which are passed to a method which checks the

Re: [Tutor] Python equiv to PHP include ?

2005-09-29 Thread Adam Cripps
On 9/29/05, Jay Loden [EMAIL PROTECTED] wrote: I've not been able to find an answer to this conundrum anywhere: My current website is done in PHP with a setup something like this: ::PHP TEMPLATE CODE:: include('file.htm') ::PHP TEMPLATE CODE:: This way, I can have PHP embedded in my htm

[Tutor] cgi.FieldStorage to int

2005-09-21 Thread Adam Cripps
I'm trying to get a cgi.FieldStorage into an int. The input is in numeric form, as it is provided by an option drop-down box. However, when I try timestable = int(form.getvalue('timestable')) I get an error that the type is None - I guess this is because FieldStorage is a class. However, I've

Re: [Tutor] cgi.FieldStorage to int

2005-09-21 Thread Adam Cripps
On 9/21/05, Kent Johnson [EMAIL PROTECTED] wrote: Adam Cripps wrote: I'm trying to get a cgi.FieldStorage into an int. The input is in numeric form, as it is provided by an option drop-down box. However, when I try timestable = int(form.getvalue('timestable')) I get an error

Re: [Tutor] cgi.FieldStorage to int

2005-09-21 Thread Adam Cripps
On 9/21/05, Kent Johnson [EMAIL PROTECTED] wrote: Adam Cripps wrote: On 9/21/05, Kent Johnson [EMAIL PROTECTED] wrote: Adam Cripps wrote: I'm trying to get a cgi.FieldStorage into an int. The input is in numeric form, as it is provided by an option drop-down box. However, when I try

[Tutor] Timer on CGI

2005-09-19 Thread Adam Cripps
Some of my pupils at school are working through simple mathematic problems (multiplication tables) through my website. I basically show some tables, they enter the results and then get feedback on how they did. I have two questions - and my guess is that one will be easier than the other. 1. I

Re: [Tutor] Timer on CGI

2005-09-19 Thread Adam Cripps
On 9/19/05, Alan Gauld [EMAIL PROTECTED] wrote: 1. I want to store the results in a mySQL database - I've done this kind of thing before using PHP - are there any good tutorial resources for using mysql with python? There is a generic DB API howto document and I have a database topic

Re: [Tutor] Python hosting again

2005-08-15 Thread Adam Cripps
On 8/11/05, Jorge Louis De Castro [EMAIL PROTECTED] wrote: Hello, I'm interested in writing with my own Python implementation of a Jabber IM server and client. Anyone knows where I could host my Python Jabber IM server for a reasonable monlthy fee? It doesn't need to be a

Re: [Tutor] MineSweeper

2005-06-25 Thread Adam Cripps
On 6/25/05, Alberto Troiano [EMAIL PROTECTED] wrote: Hey Tutors I have a question I want to make a minesweeper (just for practice) but I don't what can I use to make the GUI I was thinking about buttons (click event you know) and change the background image on change Maybe there's another

Re: [Tutor] wxPython shaped window

2005-06-25 Thread Adam Cripps
On 6/25/05, Adam Bark [EMAIL PROTECTED] wrote: Is it possible to put controls into a shaped window in wxPython. I have tried putting a button on the demo and it becomes the exact size and shape of the window. Also when I tried to bind it to an action it wouldn't even start. Adam I'm

[Tutor] Help with Tkinter teachers' report program?

2005-06-24 Thread Adam Cripps
I am a teacher and have written this little Python/Tkinter application to help me with my report writing: http://cvs.sourceforge.net/viewcvs.py/squawk/ It's released under GPL and was quite fun to write. However, currently the application only allows for 15 statements to be managed. Increasing

Re: [Tutor] Help with Tkinter teachers' report program?

2005-06-24 Thread Adam Cripps
On 6/24/05, Michael P. Reilly [EMAIL PROTECTED] wrote: On 6/24/05, Adam Cripps [EMAIL PROTECTED] wrote: I am a teacher and have written this little Python/Tkinter application to help me with my report writing: http://cvs.sourceforge.net/viewcvs.py/squawk/ It's released under GPL

Re: [Tutor] Help with Tkinter teachers' report program?

2005-06-24 Thread Adam Cripps
On 6/24/05, Michael P. Reilly [EMAIL PROTECTED] wrote: On 6/24/05, Adam Cripps [EMAIL PROTECTED] wrote: I hadn't thought about a scrollbar - that would be very useful, although doesn't add to the management side of the statement (i.e. organising them according to subjects). The user

Re: [Tutor] Python Books

2005-06-12 Thread Adam Cripps
On 6/12/05, Kristiano Ang [EMAIL PROTECTED] wrote: Hey guys, On and off, I've been looking through the Python tutorials and I've been following the Josh Cogliati tutorial. While good for the basics, I find them to be a little incomplete (i.e: Lack of answers/followups for the excercises,

[Tutor] New pet project - stripping down html content.

2005-06-10 Thread Adam Cripps
I've been working through some of the early python challenges [1] and feel enthused to scratch a current itch. However, I want to sound out my idea for the itch before I start coding to get a perspective on the direction I should take. I've recently bought a media player that also displays .txt

Re: [Tutor] (no subject)

2005-03-05 Thread Adam Cripps
On Sun, 6 Mar 2005 07:38:54 +, Adam Cripps [EMAIL PROTECTED] wrote: On Fri, 04 Mar 2005 12:14:28 -0500, Brian van den Broek [EMAIL PROTECTED] wrote: Kevin said unto the world upon 2005-03-04 10:43: Hello all. I have just completed my very first python program just a simple number

[Tutor] Saving Entry fields in Tkinter

2005-03-01 Thread Adam Cripps
I'm writing an application which has rows of Entry fields (created in a loop - see previous thread; and thanks guys!). All the content of the Entry fields are accessed through self.contentlist[i].get() Now I'm trying to save the content of those fields in a friendly format. I've used pickle in

Re: [Tutor] Saving Entry fields in Tkinter

2005-03-01 Thread Adam Cripps
On Tue, 1 Mar 2005 15:30:02 +, Adam Cripps [EMAIL PROTECTED] wrote: On Tue, 1 Mar 2005 12:52:57 +0100, Ewald Ertl [EMAIL PROTECTED] wrote: Hi! Perhaps this could help you: fileContent=open( my/file/to/read, r).readlines() for line in fileContent: print line.strip

Re: [Tutor] Saving Entry fields in Tkinter

2005-03-01 Thread Adam Cripps
On Tue, 1 Mar 2005 15:31:10 +, Adam Cripps [EMAIL PROTECTED] wrote: On Tue, 1 Mar 2005 15:30:02 +, Adam Cripps [EMAIL PROTECTED] wrote: On Tue, 1 Mar 2005 12:52:57 +0100, Ewald Ertl [EMAIL PROTECTED] wrote: Hi! Perhaps this could help you: fileContent=open( my/file

Re: [Tutor] Recursive Tkinter buttons

2005-02-27 Thread Adam Cripps
On Sun, 27 Feb 2005 16:06:32 -, Alan Gauld [EMAIL PROTECTED] wrote: - however, when I click the button, I want self.showButton to know which one of them was pressed. I've seen in other gui programming the idea of an id or identifier - I can't see that here. Ideally, I would like to

Re: [Tutor] Recursive Tkinter buttons

2005-02-26 Thread Adam Cripps
On Fri, 25 Feb 2005 12:21:18 +0100, Michael Lange snip You see, in my example above I called the list buttonlist instead of button; maybe this naming helps avoid confusion . Best regards Michael Many thanks for the help here. I got all my buttons displayed and stored in the list

[Tutor] Recursive Tkinter buttons

2005-02-24 Thread Adam Cripps
I'm trying to create recursive Tkinter buttons with: for i in range(0,10): print i buttonlabel = field +str(i) button[i] = Button (text=buttonlabel) button[i].grid(column=3, row = i+3)

Re: [Tutor] Recursive Tkinter buttons

2005-02-24 Thread Adam Cripps
On Thu, 24 Feb 2005 21:26:29 -0500, Kent Johnson [EMAIL PROTECTED] wrote: Adam Cripps wrote: I'm trying to create recursive Tkinter buttons with: for i in range(0,10): print i buttonlabel = field +str(i

[Tutor] Trying out Tkinter with problems

2005-02-19 Thread Adam Cripps
I'm trying out Tkinter as one of my first forays into GUI programming. However, I'm having a couple of problems. My intitial efforts can be seen at: http://www.monkeez.org/code/python/tkinter/min.txt or here [1]. Firstly, I'm trying to grab the contents of Entry widget entry1 with a StringVar