[Tutor] Umm.. I need help on changing Global Variables.

2015-01-29 Thread Tallen Grey Smith
So, I’m trying to make a very simple game that involves time management properly, but I’m having an issue. level = 1 player_health = 100 enemy_health = 100 steps = 10 civilians = 20 charge = 0 name_2 = 'Bob' def game(): global level global player_health global enemy_health globa

[Tutor] problems using a listbox

2017-10-17 Thread Chris Roy-Smith
/listbox.py selection is .140537834621024 Thank you for any help Regards, Chris Roy-Smith ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] problems using a listbox

2017-10-17 Thread Chris Roy-Smith
log.list.insert(END, item) mainloop() Thank you, that works, I have difficulties with object oriented coding. Never used a language where I needed it. Regards, Chris Roy-Smith ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor

[Tutor] trouble using tkinter CheckButton

2018-01-16 Thread Chris Roy-Smith
broken things down to what I think is as simple as I can get. Thank you for looking at this, Regards, Chris Roy-Smith Error message: = chris@chris-X451MA:~/Scripts/python3/dvms$ ./debugString.py Exception in Tkinter callback Traceback (most recent call last):   File

Re: [Tutor] trouble using tkinter CheckButton

2018-01-16 Thread Chris Roy-Smith
On 16/01/18 22:35, Alan Gauld via Tutor wrote: On 16/01/18 04:37, Chris Roy-Smith wrote:   File "./debugString.py", line 7, in SetFin     SetStatus[x] = var.get(x) AttributeError: 'list' object has no attribute 'get' var=[IntVar() for x in range(8)] He

[Tutor] thinter: can't figure out how to update a window instead of creating a new on

2018-01-28 Thread Chris Roy-Smith
r any assistance, I'm hoping to learn something from this experience Regards, Chris Roy-Smith #!/usr/bin/python3 import mysql.connector from tkinter import * import pickle master = Tk() def getCfg():     fobj = open('members.pkl', 'rb')     cfg = pickle.load(fobj)  

[Tutor] tkinter code executes before function returned

2018-04-15 Thread Chris Roy-Smith
gn code to wait till getcount() returns it's value? Any help greatly appreciated. Regards, Chris Roy-Smith chris@chris-X451MA:~/Scripts/python3/dvms$ ./debug1.py line 27 ###   required sign count for D is None   ### Exception in Tkinter callback Traceback (most recent call last):   File "/

Re: [Tutor] tkinter code executes before function returned

2018-04-15 Thread Chris Roy-Smith
ons after that. Regards, Chris Roy-Smith ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] tkinter code executes before function returned

2018-04-16 Thread Chris Roy-Smith
On 15/04/18 18:10, Alan Gauld via Tutor wrote: On 15/04/18 03:57, Chris Roy-Smith wrote: I am trying to get tkinter to return a number from a window, which then sets how many times to print a sign. I don;t jhave time to look at this in detail just now, maybe later. But first impressions is

[Tutor] how to change the command "string" on a tkinter Button?

2018-06-30 Thread Chris Roy-Smith
I do this, I had worked around the problem by destroying  the window and building it again, but it was pointed out that I have an unusual coding style doing this. All hints appreciated! Regards, Chris Roy-Smith ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] how to change the command "string" on a tkinter Button?

2018-07-01 Thread Chris Roy-Smith
On 01/07/18 02:17, Alan Gauld via Tutor wrote: On 30/06/18 03:55, Chris Roy-Smith wrote: I am trying to change the command of a tkinter Button in my program. Eventually I want to be able to do this to many buttons. Since I'm not 100% sure if you mean the command or the label or both here

Re: [Tutor] how to change the command "string" on a tkinter Button?

2018-07-01 Thread Chris Roy-Smith
On 01/07/18 02:17, Alan Gauld via Tutor wrote: On 30/06/18 03:55, Chris Roy-Smith wrote: I am trying to change the command of a tkinter Button in my program. Eventually I want to be able to do this to many buttons. Since I'm not 100% sure if you mean the command or the label or both here

Re: [Tutor] how to change the command "string" on a tkinter Button?

2018-07-01 Thread Chris Roy-Smith
On 01/07/18 19:19, Steven D'Aprano wrote: On Sun, Jul 01, 2018 at 03:32:59PM +1000, Chris Roy-Smith wrote: Python is the first language I have attempted since macro assembler for CP/M. Python seems to be another world. Yes indeed, high-level languages like Python *are* a radically diff

[Tutor] why can use a widget assigned to a variable or just use it on it's own?

2018-07-02 Thread Chris Roy-Smith
'hello' :print(a)).grid(row=0, column=0) main.mainloop() === any explanation gratefully recieved Regards, Chris ROy-Smith ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Debugging a sort error.

2019-01-13 Thread Stephen Nelson-Smith
Hi, On Sun, Jan 13, 2019 at 8:34 AM wrote: > description.sort() > TypeError: unorderable types: float() < str() So, fairly obviously, we can't test whether a float is less than a string. Any more than we can tell if a grapefruit is faster than a cheetah. So there must be items in description

Re: [Tutor] Python installtion

2019-01-13 Thread Stephen Nelson-Smith
Hi, On Mon, Jan 7, 2019 at 11:11 AM mousumi sahu wrote: > > Dear Sir, > I am trying to install python 2.7.10 on HPC. Python 2.6 has already been > install on root. I do not have root authority. Please suggest me how can I > do this. Sorry - I replied to you directly, by accident. Take 2, with r

[Tutor] Tkinter: Can's figure out how to put a frame in a second window

2019-03-09 Thread Chris Roy-Smith
. Also I expected the frame to be sunken, but there is no obvious signs of the frame, not even a colored background. What am I doing wrong? Thank you, Chris Roy-Smith here is my code: #! /usr/bin/python3 from tkinter import * def NewWindow():     sw=Toplevel(master)     sw.title('New W

Re: [Tutor] Tkinter: Can's figure out how to put a frame in a second window

2019-03-09 Thread Chris Roy-Smith
On 9/3/19 10:13 pm, Alan Gauld via Tutor wrote: On 09/03/2019 02:53, Chris Roy-Smith wrote: What is happening is that the contents of the frame appear in the master window. I was expecting them to show in the second window. Also I expected the frame to be sunken, but there is no obvious signs

[Tutor] is there a graphics library for common tkinter Button functions?

2019-03-20 Thread Chris Roy-Smith
Hi, Is there a "graphics library" of common button uses? that is things like forward record, back record, 1st record, last record, printer, save and the likes. I don't have very artistic abilities, so would prefer to save making my own library. Thank you

Re: [Tutor] is there a graphics library for common tkinter Button functions?

2019-03-21 Thread Chris Roy-Smith
On 21/3/19 10:19 am, Alan Gauld via Tutor wrote: On 20/03/19 22:43, Chris Roy-Smith wrote: Is there a "graphics library" of common button uses? that is things like forward record, back record, 1st record, last record, printer, save and the likes. The short answer is no. But you

Re: [Tutor] Which is better in principle: to store (in file) calculated data or to re-calculate it upon restarting program?

2019-07-31 Thread Chris Roy-Smith
On 31/7/19 2:21 am, boB Stepp wrote: I have been using various iterations of a solitaire scorekeeper program to explore different programming thoughts. In my latest musings I am wondering about -- in general -- whether it is best to store calculated data values in a file and reload these values,

Re: [Tutor] List comprehension question

2010-11-09 Thread C or L Smith
>> 1. Re: List comprehension question (Richard D. Moores) >>> ?: def proper_divisors_sum(n): >>> A few questions--noting, of course, that I'm not reading this with >>> an eye toward performance, which it seems you are, but these occur >>> to me: Tim Peters had a beautiful little version of divi

Re: [Tutor] Math: integers to a fractional power (Matthew Denaburg)

2010-11-15 Thread C or L Smith
If you are interested in a symbolic solution or numerical solution without missing any of the possible roots (real or imaginary) you could check out sympy, a CAS that offers a quartic solution. It uses appropriate simplifications besides a general solution to the quartic. The code for this is i

[Tutor] how to make classes play well together

2009-04-10 Thread C or L Smith
Unum is a module that allows one to handle units with numbers, e.g. 3*M -> 3 [m], a measurement of 3 meters. I have a module that I wrote some time ago that handles uncertainties with numbers as they are involved with calculations. Let's call it the pnum module (for physical numbers) e.g. pnum(

Re: [Tutor] Advanced String Search using operators AND, OR etc..

2009-05-04 Thread C or L Smith
>> From: Alex Feddor >> >> I am looking for method enables advanced text string search. Method >> string.find() or re module seems no supporting what I am looking >> for. The idea is as follows: >> >> Text ="FDA meeting was successful. New drug is approved for whole >> sale distribution!" >> >

Re: [Tutor] Parsing Bible verses

2009-05-23 Thread C or L Smith
Here is something from my toolbox of routines that might be useful for the number ranges: >>> indices('-5--2') [-5, -4, -3, -2] >>> indices('3-4') [3, 4] >>> indices('3-4,10') [3, 4, 10] /chris def indices(s,n=None): #("1-3,7")->1,2,3,7;i("1,-3--1")->1,-3,-2,-1; or (slc,n=None)->slc.start,stop

Re: [Tutor] (no subject)

2009-09-09 Thread C or L Smith
What about range(0, -n, -1) ? >>> That would need to have a starting value of -1 and an end value of >>> -(len(phrase)+1). Of else you can start at length - 1, end at zero >>> and a step value of -1. >> >> Another option, using "normal" range values but negative indexing is >> >> for

[Tutor] : breaking out of a function that takes too long

2009-09-16 Thread C or L Smith
>> Serdar wrote: ... >> So again, is there a way to place a time limit on the execution of a >> function, after which you can break out of it and then retry it or >> move along with the rest of your program? At http://tinyurl.com/rbre9n you can find a recipe that tells you how to decorate a funct

Re: [Tutor] Python 2.3.5 question

2009-09-23 Thread C or L Smith
>> Hello. I am Roman. I bought this book call Python Programming for >> the Absolute Beginner which I am and after I downloaded Python 2.3.5 >> from their CD, I opened IDLE, typed "Game Over" and nothing >> happened. What do I do? Please, help. I don't understand any of the >> programming jargon. P

[Tutor] tokenize problem on string literal?

2009-10-25 Thread C or L Smith
Am I misunderstanding a tokenize parse rule or is this an error: ### def tok(s): import tokenize from StringIO import StringIO t = StringIO(s).readline for ti in tokenize.generate_tokens(t): print ti tok("'''quote: \") ### produces (3, "'''quote: '''", (1, 0), (1, 13)

Re: [Tutor] tokenize problem on string literal?

2009-10-25 Thread C or L Smith
C or L Smith wrote: > Am I misunderstanding a tokenize parse rule or is this an error: > > ### > def tok(s): > import tokenize > from StringIO import StringIO > t = StringIO(s).readline > for ti in tokenize.generate_tokens(t): >

[Tutor] alternation regex--greedy?

2005-11-04 Thread Chris or Leslie Smith
Hello, I am writing a script to convert from one font set (used to write in devanagari) to another. This consists of converting certain key sequences to others, e.g. Of --> k. To do the conversion process, I've looked at some of the single-pass multireplacement suggestions posted in the Python

Re: [Tutor] overlay

2005-11-06 Thread Chris or Leslie Smith
| From: Shi Mu | Is there any sample code to calculate the overlaid area between two | polygons? | Thanks! | The polygon module at ( http://www.dezentral.de/warp.html?http://www.dezentral.de/soft/Polygon/ ) was found by googling for "polygon module python". If by "overlay" you mean the area

Re: [Tutor] geometry

2005-11-07 Thread Chris or Leslie Smith
| any python code for middle school geometry teaching use? | for instance, calculate the polygon area size, overlaid area size? | Thanks. | Yes, the module I refered to in response to the email with subject "Overlay" will handle these calculations. Again, see ( http://www.dezentral.de/warp.ht

[Tutor] unicode characters from integers?

2005-11-09 Thread Chris or Leslie Smith
I know that chr() can be used to convert an integer into an ASCII character, but I am having a hard time trying to generate unicode characters from numbers. e.g. say I want to generate u'\u0950' from the integer 950, does anyone know if/how this can be done? Here are some failures: ### >>> uni

Re: [Tutor] split a tuple

2005-11-17 Thread Chris or Leslie Smith
| Hi, | | I couldn't get idea how to make the next thing | n=4 #split into so long parts l = (1,2,3,4,5,1,2,3,4,5,1,2,3,4,5) #this is the tuple to split [l[i:i+n] for i in range(0,len(l),n)] | [(1, 2, 3, 4), (5, 1, 2, 3), (4, 5, 1, 2), (3, 4, 5)] | | But I have to make it like thi

Re: [Tutor] Tutor Digest, Vol 21, Issue 79

2005-11-18 Thread Chris or Leslie Smith
Orri Ganel wrote: Another way to do this would be: | import sys for i in range(len(sequence)-1,-1,-1): | sys.stdout.write(sequence[i]) || It might be interesting to note that although this *range* works for accessing the indices, you can't do the same directly in slice notatio

Re: [Tutor] Newbie ?

2005-11-18 Thread Chris or Leslie Smith
Orri Ganel wrote: Another way to do this would be: | import sys for i in range(len(sequence)-1,-1,-1): | sys.stdout.write(sequence[i]) || It might be interesting to note that although this *range* works for accessing the indices, you can't do the same directly in slice notatio

Re: [Tutor] files - strings - lists

2005-11-23 Thread Chris or Leslie Smith
| | With these tools the solution is pretty simple. I agree that handling this with Python is pretty straightforward, but I'm wondering if there exists some sort of mechanism for reading these types of well structured (though not XML format, etc...) files. Something like a reverse template, s

Re: [Tutor] files - strings - lists

2005-11-23 Thread Chris or Leslie Smith
Danny Yoo wrote: | On Wed, 23 Nov 2005, Chris or Leslie Smith wrote: | || I agree that handling this with Python is pretty straightforward, but || I'm wondering if there exists some sort of mechanism for reading || these types of well structured (though not XML format, etc...) files. |

Re: [Tutor] files - strings - lists

2005-11-23 Thread Chris or Leslie Smith
Danny wrote: | Hi Chris, | | Yes, I suspect that this happens a lot. I have my own little formatting | reader that simulates some of the features of C's scanf, for example: | |http://hkn.eecs.berkeley.edu/~dyoo/python/scanf/ | | so I think it's one of those little exercises that everyone e

Re: [Tutor] lil help please - updated (fwd)

2005-11-24 Thread Chris or Leslie Smith
| I have about 150 lines of python extracting text from large file, the | problem I need a few lines to clean first to avoid the problem the | script is facing Hello, This seems like a well laid out task. If you post what you are trying and the problems you are encountering, that would be helpfu

Re: [Tutor] lil help please - updated (fwd)

2005-11-25 Thread Chris or Leslie Smith
| I think I would split this into three phases: | - collect the data into groups of HFR | - process each group by rearranging, renumbering, reporting errors | - output the processed groups | | One potential problem is to resynchronize to the next group when | there is a sequence error. If there is

Re: [Tutor] lil help please - updated (fwd)

2005-11-25 Thread Chris or Leslie Smith
| The logic is so good so far. However, How do we move the (...) in |H | to end of |R and before next |H Maybe you are thinking too literally about the moving of the parenthetical item from the |H to the end of the |R. Let's say you have the 3 chunks of information in variables h, f, and r: ##

Re: [Tutor] Scientific Notation + 18 digit precision

2005-11-26 Thread Chris or Leslie Smith
| The display function operates on each line in the .py file and | provides 4 formatted columns for: | Variable Name, Data (18 digits ), Assignment Formula, and Comments. | There are a couple of recipes at ASPN that might be useful with table generation: http://aspn.activestate.com/ASPN/Cookb

Re: [Tutor] Accessing next and previous items during iteration

2005-12-16 Thread Chris or Leslie Smith
| Is it possible to access the next and previous items during an | iteration? | | I want to use it to iterate through html files in a folder and add | links in to the next and previous pages. | I just did this :-) What I did was 1) use the glob module to get a list of the files in the directory

Re: [Tutor] Accessing next and previous items during iteration

2005-12-16 Thread Chris or Leslie Smith
| Is it possible to access the next and previous items during an | iteration? | | I want to use it to iterate through html files in a folder and add | links in to the next and previous pages. | I just did this :-) What I did was 1) use the glob module to get a list of the files in the directory

Re: [Tutor] Accessing next and previous items during iteration

2005-12-16 Thread Chris or Leslie Smith
| Is it possible to access the next and previous items during an | iteration? | | I want to use it to iterate through html files in a folder and add | links in to the next and previous pages. | I just did this :-) What I did was 1) use the glob module to get a list of the files in the directory

[Tutor] synchronized enumeration

2005-12-16 Thread Chris or Leslie Smith
Has anyone else run into the desire to synchronize the indices that are being used during an enumeration with the true indices of the list that is being enumerated when you use a slice of the list? e.g. more than a couple of times, I want to use the enumeration function, but I don't want to sta

Re: [Tutor] synchronized enumerate

2005-12-19 Thread Chris or Leslie Smith
Kent wrote: | Take a look at this thread on c.l.py for some discussion and | possibilities. The part you | are interested in starts around message 14. | http://groups.google.com/group/comp.lang.python/browse_frm/thread/ab1658dca4023e2b?hl=en&; | After looking at that I found something on python-d

Re: [Tutor] list method help

2006-02-02 Thread Chris or Leslie Smith
| Hello, | was just trying to do something and tried the following code: | | list = ["1", "test", "1.5"] | | for x in list: | print list.pop(x) | | I get the following error: | | print list.pop(x) | TypeError: an integer is required | | Does this mean i can't use a for loop to po

[Tutor] documentation/sourceforge bug help

2006-10-30 Thread C or L Smith
I know this is off topic, but can anyone give me a hand? I have a sourceforge account. I want to make a correction to the python documentation. I click on the appropriate link at the bottom of the documentation page and then the bug tracker link on the page that I am sent to which takes me to

Re: [Tutor] documentation/sourceforge bug help

2006-10-30 Thread C or L Smith
Danny Yoo wrote: | On Mon, 30 Oct 2006, C or L Smith wrote: | || Can anyone help me figure out how to actually get logged in so I can || file the report? | | Do you happen to have cookies disabled? You might need to enable | them, since that's what SF will use to track your login status.

Re: [Tutor] How to group data?

2011-02-13 Thread C or L Smith
>>temp_values1 = >> (x.pop(9))+(x.pop(8))+(x.pop(7))+(x.pop(6))+(x.pop(5))+(x.pop(4))+(x.pop(3))+(x.pop(2))+(x.pop(1))+(x.pop(0)) >> temp_values2 = >> (x.pop(19))+(x.pop(18))+(x.pop(17))+(x.pop(16))+(x.pop(15))+(x.pop(14))+(x.pop(13))+(x.pop(12))+(x.pop(11))+(x.pop(10)) When you pop a valu

<    1   2   3   4   5