== 3:
next_board[x][y] = 1
elif board[x][y] == 1 and (live_neighbours == 2 or
live_neighbours == 3):
next_board[x][y] = 1
#else:
#next_board[x][y] = board[x][y]
board = next_board
display()
--
Regards,
Phil
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor
exited, so your bytes may be lurking in the
buffer, unsent.
Thank you Cameron, that sounds like a logical explanation. I'll try it.
--
Regards,
Phil
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
https://
7;ve appended the newline _before_ converting to bytes,
Thank you for the code and the explanation, it's greatly appreciated.
It's all a bit of an anticlimax really. Now that it works I don't know
what to do with it. Like so many of my projects.
--
Regards,
Phil
__
attempt:
mytext = "Fred"
mybytes = bytes(mytext)
byte = byte + '\n'
ser.write(mybytes)
I don't understand why this works from the pyqt IDE but not when run
from the console. I suppose the IDE is adding the correct encoding. I
suspect utf8 is involved somewhere.
--
Regard
f frames
is now clearer to me now, plus I now see why I should include the use of
columnconfigure and sticky.
I knew about tix but hadn't investigated it until now. I'll have to play with
it.
--
Regards,
Phil
___
Tutor maillist - Tutor@py
(frame).pack(padx = 20, pady = 20)
#Entry(frame).grid(row = 10, column = 1)
#Entry2 = Entry
#Entry2(frame).grid(row = 20, column = 1)
root = Tk()
app = App(root)
root.mainloop()
--
Regards,
Phil
___
Tutor maillist -
s, they're all sets. I now have a working
solution.
Many of the methods have very similar code to each other and I'm currently
working on making the code simpler and less confusing. After that I'll give
programming a rest for awhile.
--
Regards,
Phil
thon in a little over a week.
The strings are the given numbers while the sets are the likely candidates.
--
Regards,
Phil
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor
On Fri, 28 Apr 2017 19:42:36 -0700
"Martin A. Brown" wrote:
>
> Hello and greetings Phil,
>
> >> I'm trying to implement a conditional branch based on a variable
> >> type.
> >
> >This is often (not always) a mistake, in Python. So the qu
nly interested in the sets and want to
ignore the character lists.
I have come up with a method that will probably work but it's become quite
messy with multiple compare statements. Something simple and less prone to
cause headaches would be better.
--
Regards,
Phil
__
lding the throwaway single-entry set.
Thank you Peter. I have been using the remove() method which, by the look of
it, may do the same thing as discard(). I'll have a play and see.
--
Regards,
Phil
___
Tutor maillist - Tutor@python.org
To unsubscr
On Thu, 27 Apr 2017 01:58:39 +
eryk sun wrote:
> That exception indicates you probably used set(int(num)) instead of
> either {int(num)} or set([int(num)]).
Thank you Eryl, you are correct. Problem solved.
--
Regards,
Phil
___
Tutor ma
On Wed, 26 Apr 2017 18:56:40 -0600
Mats Wichmann wrote:
> On 04/26/2017 06:33 PM, Phil wrote:
> > Another question I'm afraid.
> >
> > If I want to remove 1 from a set then this is the answer:
> >
> > set([1,2,3]) - set([1])
> >
> > I had this
this time the one set is represented as {'1'} and, of
course {'1'} is not in the set {1,2,3}.
Ideally, I would like {'1'} to become {1}. Try as I may, I have not discovered
how to remove the '' marks. How do I achieve that?
--
Regards,
Phil
hen I get back.
Thanks Alan, maybe the reason that I'm in the moderation queue is because I'm
on the bounces list. I'm on six different bounces lists but I'm still receiving
e-mail so I suppose there isn't a real problem.
--
Regards,
Phil
__
On Mon, 24 Apr 2017 20:02:32 +0100
Alan Gauld via Tutor wrote:
> On 24/04/17 01:50, Phil wrote:
> > On Mon, 24 Apr 2017 09:24:55 +1000
> > Phil wrote:
> >
> >> On Sun, 23 Apr 2017 09:39:54 +0200
> >> Sibylle Koczian wrote:
> >>
> >
d that root.mainloop() isn't necessary in that the
> > result is the same with or without. Perhaps it serves some other
> > purpose?
>
> Try running it from the command line, not in idle. In every tkinter
> program there must be a main loop to respond to events.
Thank y
On Mon, 24 Apr 2017 09:24:55 +1000
Phil wrote:
> On Sun, 23 Apr 2017 09:39:54 +0200
> Sibylle Koczian wrote:
>
> > Am 20.04.2017 um 14:43 schrieb Alan Gauld via Tutor:
> > > Its not too bad you can map the large 9x9 table to the smaller
> > > units using divmod
; 2,1
> >
>
> Should be divmod(7, 3), shouldn't it?
Thanks Sibylle, I eventually stumbled upon the answer using my usual
trial-and-error method. The 3, as in the number of cells, was the key.
--
Regards,
Phil
___
Tutor maillist - T
Thank you again Peter. Of course your changes worked but at the moment I'm not
sure why.
if root = tk.Tk() then why isn't table_class.DisplayTable(root, the same as
table_class.DisplayTable(tk.Tk(),. Obviously it isn't but I don't know why.
Also I found that root.mainl
ellcolor='green',
gridcolor='red',
hdcolor='black')
second_tab.pack(side = tk.LEFT)
tab.pack()
I've tried different pack options including packing onto the parent frame.
--
Regards,
Phil
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor
> "Best practice" is to avoid star imports which bind every name from
> table_class that does not start with "_", including 'tk' to the same
> name in the importing module.
>
Thank you Petter for explaining these points, most helpful.
--
Regards,
P
k() other than a
reference to tkinter.
Have I used you table class correctly? It works, of course, but it doesn't look
correct.
--
Regards,
Phil
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor
nk you for your detailed answer, more food for though.
--
Regards,
Phil
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor
On Wed, 19 Apr 2017 22:21:28 -0500
Just to save people answering this question unnecessarily I have solved the
immediate problem. I can now enter a digit at the mouse coordinates. Some
refinement is still necessary.
--
Regards,
Phil
___
Tutor
that I need a magnifying glass to read them.
Anyway, maybe I can justify one book, I'll give it some thought. The massive
tome by Lutz comes to mind.
I'll give your keyboard entry suggestion some more thought.
--
Regards,
Phil
___
Tutor maill
gards,
Phil
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor
didn't think
about the_canvas being just another attribute of the class. It seem obvious now
that I've been shown.
--
Regards,
Phil
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor
0, 250, anchor=NW,
window=solve_button)
def solve(self):
print("solve called")
self.the_canvas.create_text(20,20,text="5")
def main():
root = Tk()
app = Sudoku(root)
app.mainloop()
if __name__ == '__main__':
main()
--
Regards,
Phil
_
and
wondered if "event" was the other parameter. I hadn't though of printing the
event.
Take no notice of this message's posting time, I started my Raspberry Pi before
the modem had established an Internet connection. It's pre sunrise here.
--
Regards,
Phil
_
ave off "self", this is the result:
Exception in Tkinter callback
Traceback (most recent call last):
File "/usr/lib/python3.4/tkinter/__init__.py", line 1536, in __call__
return self.func(*args)
TypeError: my_method() takes 1 positional a
', self.my_function)
def my_function(event):
print("function called")
The function is not called and I know that the binding of the function to the
entry boxes is not the correct method. What am I missing?
--
Regards,
Phil
__
; master,
> text="Check",
> command=self.check_2_2 # note there's no () -- the bound
> method # is not invoked
> )
> ...
>
My working method uses the () but I will remove them and see what difference it
makes.
--
Regards,
Phil
On Sat, 8 Apr 2017 02:00:38 +1000
This is one of those times where I wish I could delete a sent message.
After a bit more thought I now realise that I just need to use self to
reference e[][] in my check function.
--
Regards,
Phil
___
Tutor maillist
On Sat, 8 Apr 2017 02:00:38 +1000
Phil wrote:
If I define "e" lists before the class then everything works as I had expected,
however, I don't that's technically correct. Or is it?
--
Regards,
Phil
___
Tutor maillist -
_button.grid(row=7, column=7)
def check(self, array):
print("checked")
array[2][2].insert(0, "4")
root = Tk()
my_gui = TestGUI(root)
root.mainloop()
--
Regards,
Phil
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor
]]
>
Thank you Peter, that makes sense.
What I'm trying to do is convert a sudoku solver that I wrote using C++ and the
QT library in 2005. As well as coming to grips with Tkinter I'm having trouble
following my C++ code.
--
Regards,
Phil
___
do get a good workout.
In this case I become confused because had expected [][] to be the same as a C
two dimensional array.
--
Regards,
Phil
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor
but haven't turned up anything. Where had I failed?
--
Regards,
Phil
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor
On 26/02/17 19:41, Peter Otten wrote:
Try
buf.decode("utf-8")
Thank you once again Peter.
--
Regards,
Phil
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor
On 26/02/17 18:42, Alan Gauld via Tutor wrote:
On 26/02/17 06:44, Phil wrote:
s.connect((host, 1210))
data = "GET_LIST"
This is a string, you need to use bytes.
data = bytes("GET_LIST",'utf8')
Thank you Peter and Alan for your response.
Converting "da
f not len(buf):
break
#print "Received: %s" % buf
According to the Python3 wiki sendto() should work under Python3 but I
get this error:
Traceback (most recent call last):
File "/home/phil/Python/predict_client1.py", line 12, in
s.sendall(data)
TypeError: a
response that I had expected. However, if I
send a command to the client and use read_until() then I do get the
result from the command that I expected.
Thanks again, I was on the verge of giving this idea away.
--
Regards,
Phil
___
Tutor maillist -
On 25/09/16 01:01, David Rock wrote:
On Sep 24, 2016, at 04:21, Phil wrote:
The problem is that the client is not responding, certainly not as expected.
There aren't any Python errors either, however, the console is blocked until
the client is disabled. If I then attempt a connection
anywhere plus the telnetlib module seemed to be a more logical choice.
Is there some advantage to using the socket module?
--
Regards,
Phil
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/m
on a very basic problem.
By the way, I'm using Python 3.5 under Linux.
--
Regards,
Phil
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor
I hope this is not another embarrassingly obvious answer to a simple
question.
Python 3, under Kubuntu.
xrange() fails whereas range() is accepted. Could this be an
installation problem?
phil@Asus:~/Python$ python3
Python 3.4.2 (default, Oct 8 2014, 13:18:07)
[GCC 4.9.1] on linux
Type
QPython on my tablet with the aim of porting a programme that
I'd written in C++ 15 years ago to Python. Cutting and pasting and even
moving around the IDE turned out to be a truly frustrating exercise.
I wonder if it was just my clumsiness or if others have had the same
error;
TypeError: 'int' object is not iterable
The array module looks like the answer because it seems to function in
the same way as an array under C. However, it seems to me that I should
be able to do the same thing with a list.
Is there a way to add a value to a list of ints?
-
pass the variable key's value and return
the variable tag's value.
Thanks in advance for any help, I've tried a bunch of stuff and its just not
working.
Phil
___
Tuto
On 11/29/2013 06:17 PM, Dominik George wrote:
Hi,
So, how can I ensure that port A is always ttyUSB0
http://hintshop.ludvig.co.nz/show/persistent-names-usb-serial-devices/
Thank you Dominik, the link answers my question exactly.
--
Regards,
Phil
ports. The problem is the random
allocation of the ports. Port A, for example, could be either ttyUSB0 or
ttyUSB1.
So, how can I ensure that port A is always ttyUSB0 or how can I adapt my
programme so that the address of the port is known to the programme?
--
Regards,
Phil
etter
understanding of how json works.
I discovered my error just before receiving your reply. I'm a little
embarrassed to admit that despite giving you the correct url I had
attempted to get the results from another tatts page.
Thank you again, your help is greatly appre
It turns out that urllib2 and 3 are both built into python so I didn't
have to stress over the dependency error. However, I do have an error
and I'm not completely certain that I understand how the code provided
by Peter works. The following is the error message:
Traceback (most
same dependency problem. I haven't
checked to see if it's built into Python yet, it's getting a bit late
here. A job for tomorrow.
--
Regards,
Phil
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
ht
On 19/05/13 18:05, Peter Otten wrote:
Phil wrote:
My apatite having been whetted I'm now stymied because of a Ubuntu
dependency problem during the installation of urllib3. This is listed as
a bug. Has anyone overcome this problem?
Perhaps there's another library that I can use t
My apatite having been whetted I'm now stymied because of a Ubuntu
dependency problem during the installation of urllib3. This is listed as
a bug. Has anyone overcome this problem?
Perhaps there's another library that I can use to download data from a
web page?
--
Reg
lts and there isn't a simple way, as far as I can see, to do
this. I'll read up on curl, maybe I can use it.
I'll experiment with the Peter's code and Beautiful Soup and see what I
can come up with. Maybe unzipping the file could be the best solution,
I'll experiment with
oment, how I might do that but
I have something to work with.
--
Regards,
Phil
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
tever1.jpg,
whatever2.jpg, ...? Then you could infer the value from the name.
If not, is a digit always represented by the same image? Then you could map
the image urls to the digits.
Good point Peter, I'll investigate.
--
Regards,
Phil
___
On 18/05/13 16:33, Alan Gauld wrote:
On 18/05/13 00:57, Phil wrote:
I'd like to "download" eight digits from a web site where the digits are
stored as individual graphics. Is this possible, using perhaps, one of
the countless number of Python modules? Is this the function of a we
I'd like to "download" eight digits from a web site where the digits are
stored as individual graphics. Is this possible, using perhaps, one of
the countless number of Python modules? Is this the function of a web
scraper?
--
Regards,
Phil
__
On 04/04/13 16:58, Peter Otten wrote:
Phil wrote:
I think I must be very close now so I'll post just the code that I think
is relevant.
This the main window class:
import satListDialog
Here you are importing the module "satListDialog"
class MainWindow(QMainWindow, Ui_Mai
On 04/04/13 11:58, Steven D'Aprano wrote:
On 04/04/13 12:47, Phil wrote:
And this is the error message;
"global name 'Ui_satListDialog' is not defined"
On its own, that is almost useless.
Python gives you more debugging information than that: it gives you a
on_actionList_triggered(self) function but I still end up with a "not
defined" error.
--
Regards,
Phil
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
On 04/04/13 09:32, Alan Gauld wrote:
On 04/04/13 00:14, Phil wrote:
If this was C++ then I'd need to include a class header and so I'm
thinking that an import statement is needed in the main window class
referring to the dialog class. Import SatelliteListDialog isn't correct.
rect.
There are many on-line examples that deal with displaying dialogs,
however, both classes are in the same file rather that being separated.
No doubt, this is a trivial question but, as yet, I have not found an
answer.
--
Regards,
Phil
___
Tutor ma
On 01/04/13 19:47, eryksun wrote:
On Sun, Mar 31, 2013 at 8:13 PM, Phil wrote:
I have the answer (provided by a member of another list) and I was correct,
it was something basic.
from PyQt4 import QtGui
QtGui.QTable etc
Sorry, I assumed you were familiar with the package layout.
http
d I was
correct, it was something basic.
from PyQt4 import QtGui
QtGui.QTable etc
As I previously said, I had done this under C++ many years ago. The
Python method is far simpler, especially once you know how.
--
Regards,
Phil
___
Tutor maillist - T
t night and this is the result;
"global name 'QTableWidgetItem' is not defined"
You are correct, I can easily set all of the labels at once but only one
label needs to be modified according to it's cell contents. I'm sure I'm
missing something very basic.
--
R
On 31/03/13 14:29, Phil wrote:
Thank you for reading this.
I want to set a table widget header based on its cell contents.
The following sets all of the headers;
self.tableWidget.setHorizontalHeaderLabels(["One", "Two", "Etc"])
However, self.setHorizonta
this for quite some time and searched
the Internet for an answer. Can anyone offer a suggestion?
--
Regards,
Phil
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
On 26/03/13 23:15, Dave Angel wrote:
Traceback (most recent call last):
File "socket2.py", line 6, in
import socket #for sockets
File "/home/phil/Python/socket.py", line 7, in
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
AttributeError:
' + msg[1]
sys.exit()
Traceback (most recent call last):
File "socket2.py", line 6, in
import socket #for sockets
File "/home/phil/Python/socket.py", line 7, in
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
AttributeError
hanks Bodsda,
I had a brief look through the black list files a couple of days ago and
didn't find any mention of pcspkr. I've decided to drop this and simply
use a sound module because they provide greater scope for experimentation.
--
Regards,
Phil
On 25/03/13 04:30, xDog Walker wrote:
Maybe something here:
http://code.activestate.com/search/recipes/#q=beep
Thanks xDog, yet another sound library (pyaudio) to play with.
--
Regards,
Phil
___
Tutor maillist - Tutor@python.org
To unsubscribe
and less time playing with the computer.
It's amazing what's available to play with these days.
--
Regards,
Phil
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
On 24/03/13 12:18, Steven D'Aprano wrote:
On 24/03/13 10:31, Phil wrote:
Actually, I didn't think there was any need to make any guesses since
"echo -e" is exclusively a Linux command.
Nonsense. Not only does echo exist as a command on any Unix, including
Apple Mac
On 24/03/13 03:42, Bod Soutar wrote:
On Mar 23, 2013 2:24 AM, "Steven D'Aprano" mailto:st...@pearwood.info>> wrote:
>
> On 23/03/13 12:48, Phil wrote:
>>
>> Just out of curiosity how can a beep sound be generated?
>>
>> My interest in t
\a', under Idle, causes a bell icon to be displayed so it seems
that the lack of a beep is due to a system setting.
A Google search has shown several methods to play .wav files, some
easier than others. Perhaps Pulse Audio has made '\a' redundant?
--
Regards,
Phil
_
m not sure it's a simplification at my
present level.
--
Regards,
Phil
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
On 20/03/13 14:54, Amit Saha wrote:
Hello Phil,
On Wed, Mar 20, 2013 at 12:54 PM, Phil wrote:
Thank you for reading this.
I'm working my way through a series of exercises where the author only
provides a few solutions.
The reader is asked to modify the histogram example so that it use
return d
def histogram2(s):
d = dict()
for c in s:
d[c]= d.get(c, 0)
return d
h = histogram("brontosaurs")
print h
print
print "histogram2"
h = histogram2("brontosaurs")
print h
--
Regards,
Phil
_
The usage of print to file is much like the Arduino print to serial
device and it's got me curious to know what the correct syntax is.
Neither of the following is correct, but the second one seems closer to
the mark.
>>> print("test", file="/home/phil/Python/w
84 matches
Mail list logo