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
/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
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
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
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
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)
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 "/
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
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
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
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
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
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
'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
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
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
. 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
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
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
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
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,
>> 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
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
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(
>> 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!"
>>
>
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
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
>> 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
>> 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
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)
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):
>
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
| 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
| 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
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
| 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
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
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
|
| 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
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.
|
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
| 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
| 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
| 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:
##
| 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
| 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
| 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
| 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
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
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
| 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
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
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.
>>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
401 - 454 of 454 matches
Mail list logo