Re: [newbie] advice and comment wanted on first tkinter program

2014-01-27 Thread Jean Dupont
Op woensdag 22 januari 2014 16:43:21 UTC+1 schreef Alister:
 On Wed, 22 Jan 2014 06:45:53 -0800, Jean Dupont wrote:

  Op maandag 20 januari 2014 10:17:15 UTC+1 schreef Alister:
  On Sun, 19 Jan 2014 20:04:05 -0800, Jean Dupont wrote:
 
   Op zaterdag 18 januari 2014 16:12:41 UTC+1 schreef Oscar Benjamin:
   On 18 January 2014 14:52, Jean Dupont jeandupont...@gmail.com
   wrote:
   
Thanks Peter and Terry Jan for the useful suggestions. One thing
which I
   find a bit weird: when asking for Python-help concerning raspberry
  Personally  use Geany  stand alone and not under idle, pressing F5
  should save  run the code you are currently editing. Would running
  under idle give any other benefits?
  I don't know yet, but I just wanted to try out which of the following
  three I'd like best:
  1. idle+leafpad 2. idle+geany 3. plain geany
  
  It's normal for a newbie to start with (1) as that is the default on
  raspbian,
  however I still don't understand why (2) does not work...
  
 When I play with my Pi I tend to use another computer for all my editing
 (sshfs is a quick  easy way for me to mount the necessary parts of the 
 PI file system so I don't have to keep transferring files)
Thanks for the suggestion, I'm going to try it out

kind regards,
jean
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: [newbie] advice and comment wanted on first tkinter program

2014-01-27 Thread Jean Dupont
Op woensdag 22 januari 2014 15:45:53 UTC+1 schreef Jean Dupont:
 Op maandag 20 januari 2014 10:17:15 UTC+1 schreef Alister:
  On Sun, 19 Jan 2014 20:04:05 -0800, Jean Dupont wrote:
 
   Op zaterdag 18 januari 2014 16:12:41 UTC+1 schreef Oscar Benjamin:
   On 18 January 2014 14:52, Jean Dupont jeandupont...@gmail.com wrote:
   
Thanks Peter and Terry Jan for the useful suggestions. One thing
which I
   find a bit weird: when asking for Python-help concerning raspberry pi
   code
or problems, a lot of people don't seem to be interested in helping
out,
that's of course their choice, but maybe they don't seem to be aware
the raspberry pi is often the motivation for starting to learn to
program in
   Python. And as such such a reaction is a bit disappointing.
   Hi Jean,
   What makes you say that? Did you previously ask questions about
   Rasberry Pi code on this list?
   It was not about code but about python-coding in IDLE (that's the
   default on raspbian):
   I started a thread [newbie] starting geany from within idle does not
   work both here and in the raspberry pi forum. I just wondered why I
   never got an answer concerning that topic.
   
   If you did I wouldn't have answered those questions because I've never
   used a Raspberry Pi and know nothing about them (except that they
   encourage using Python somehow). I think that there's actually a list
   that is specifically for Raspberry Pi Python questions that might be
   more helpful although I don't know what it is...
   Here is the url to that forum
   
   http://www.raspberrypi.org/forum/
   
   kind regards,
   jean
 
  Personally  use Geany  stand alone and not under idle, pressing F5 should 
  save  run the code you are currently editing. Would running under idle 
  give any other benefits? 
 I don't know yet, but I just wanted to try out which of the following three 
 I'd like best:
 1. idle+leafpad
 2. idle+geany
 3. plain geany

 It's normal for a newbie to start with (1) as that is the default on raspbian,
 however I still don't understand why (2) does not work...
I finally found out where I was wrong: leafpad is _not_ the default choice
in IDLE, IDLE has its own built in editor and IDLE does not allow to use
another editor. The confusion stemmed from the properties I got when right
clicking on the IDLE-icon on the raspbian desktop, which shows Open with
and then suggests the default choice is Leafpad and Geany as a second
choice, it has however nothin to do with IDLE as such.

kind regards,
jean
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: [newbie] advice and comment wanted on first tkinter program

2014-01-22 Thread Dave Angel
 Jean Dupont jeandupont...@gmail.com Wrote in message:
 Op maandag 20 januari 2014 07:24:31 UTC+1 schreef Chris Angelico:
 On Mon, Jan 20, 2014 at 3:04 PM, Jean Dupont jeandupont...@gmail.com wrote:
  I started a thread [newbie] starting geany from within idle does not
  work 


 I did try to do the same on my linux desktop computer, but the problem is,
 it has another desktop environment (KDE4). In the rpi-environment it is
 possible
 (but it doesn't work) to change the default IDLE-editor by right-clicking
 the idle-icon and choosing geany in stead of leafpad, however the same
 can't be done
 in KDE4, I hoped to find a similar setting once running IDLE in
 Options--Configure IDLE, but nothing there neither. I also looked
 unsuccessfuly in the .idlerc-directory for a config-file. Hence my initial
 question.
 

What does idle offer that Geary does not?  Why not just run Geary
 from your terminal prompt? 
 


-- 
DaveA

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: [newbie] advice and comment wanted on first tkinter program

2014-01-22 Thread Jean Dupont
Op maandag 20 januari 2014 10:17:15 UTC+1 schreef Alister:
 On Sun, 19 Jan 2014 20:04:05 -0800, Jean Dupont wrote:

  Op zaterdag 18 januari 2014 16:12:41 UTC+1 schreef Oscar Benjamin:
  On 18 January 2014 14:52, Jean Dupont jeandupont...@gmail.com wrote:
  
   Thanks Peter and Terry Jan for the useful suggestions. One thing
   which I
  find a bit weird: when asking for Python-help concerning raspberry pi
  code
   or problems, a lot of people don't seem to be interested in helping
   out,
   that's of course their choice, but maybe they don't seem to be aware
   the raspberry pi is often the motivation for starting to learn to
   program in
  Python. And as such such a reaction is a bit disappointing.
  Hi Jean,
  What makes you say that? Did you previously ask questions about
  Rasberry Pi code on this list?
  It was not about code but about python-coding in IDLE (that's the
  default on raspbian):
  I started a thread [newbie] starting geany from within idle does not
  work both here and in the raspberry pi forum. I just wondered why I
  never got an answer concerning that topic.
  
  If you did I wouldn't have answered those questions because I've never
  used a Raspberry Pi and know nothing about them (except that they
  encourage using Python somehow). I think that there's actually a list
  that is specifically for Raspberry Pi Python questions that might be
  more helpful although I don't know what it is...
  Here is the url to that forum
  
  http://www.raspberrypi.org/forum/
  
  kind regards,
  jean

 Personally  use Geany  stand alone and not under idle, pressing F5 should 
 save  run the code you are currently editing. Would running under idle 
 give any other benefits? 
I don't know yet, but I just wanted to try out which of the following three I'd 
like best:
1. idle+leafpad
2. idle+geany
3. plain geany

It's normal for a newbie to start with (1) as that is the default on raspbian,
however I still don't understand why (2) does not work...

kind regards,
jean
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: [newbie] advice and comment wanted on first tkinter program

2014-01-22 Thread Alister
On Wed, 22 Jan 2014 06:45:53 -0800, Jean Dupont wrote:

 Op maandag 20 januari 2014 10:17:15 UTC+1 schreef Alister:
 On Sun, 19 Jan 2014 20:04:05 -0800, Jean Dupont wrote:

  Op zaterdag 18 januari 2014 16:12:41 UTC+1 schreef Oscar Benjamin:
  On 18 January 2014 14:52, Jean Dupont jeandupont...@gmail.com
  wrote:
  
   Thanks Peter and Terry Jan for the useful suggestions. One thing
   which I
  find a bit weird: when asking for Python-help concerning raspberry
 Personally  use Geany  stand alone and not under idle, pressing F5
 should save  run the code you are currently editing. Would running
 under idle give any other benefits?
 I don't know yet, but I just wanted to try out which of the following
 three I'd like best:
 1. idle+leafpad 2. idle+geany 3. plain geany
 
 It's normal for a newbie to start with (1) as that is the default on
 raspbian,
 however I still don't understand why (2) does not work...
 
When I play with my Pi I tend to use another computer for all my editing
(sshfs is a quick  easy way for me to mount the necessary parts of the 
PI file system so I don't have to keep transferring files)




-- 
People in general do not willingly read if they have anything else to
amuse them.
-- S. Johnson
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: [newbie] advice and comment wanted on first tkinter program

2014-01-21 Thread Jean Dupont
Op maandag 20 januari 2014 07:24:31 UTC+1 schreef Chris Angelico:
 On Mon, Jan 20, 2014 at 3:04 PM, Jean Dupont jeandupont...@gmail.com wrote:
  I started a thread [newbie] starting geany from within idle does not
  work both here and in the raspberry pi forum. I just wondered why I never
  got an answer concerning that topic.
 I saw that thread. It looked like a R-Pi problem, not a Python one, so
 I didn't respond because I don't have an R-Pi. If you get no response
 on the R-Pi forum, you might want to see if you can duplicate the
 issue on a desktop computer - preferably on Win/Mac/Lin, as those are
 the platforms most people use. That, with exact steps to repro (which
 it looks like you gave for the R-Pi, though again I can't verify),
 would get some interest.
I did try to do the same on my linux desktop computer, but the problem is,
it has another desktop environment (KDE4). In the rpi-environment it is
possible
(but it doesn't work) to change the default IDLE-editor by right-clicking
the idle-icon and choosing geany in stead of leafpad, however the same
can't be done
in KDE4, I hoped to find a similar setting once running IDLE in
Options--Configure IDLE, but nothing there neither. I also looked
unsuccessfuly in the .idlerc-directory for a config-file. Hence my initial
question.

kind regards,
jean
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: [newbie] advice and comment wanted on first tkinter program

2014-01-20 Thread Alister
On Sun, 19 Jan 2014 20:04:05 -0800, Jean Dupont wrote:

 Op zaterdag 18 januari 2014 16:12:41 UTC+1 schreef Oscar Benjamin:
 On 18 January 2014 14:52, Jean Dupont jeandupont...@gmail.com wrote:
 
  Thanks Peter and Terry Jan for the useful suggestions. One thing
  which I
 find a bit weird: when asking for Python-help concerning raspberry pi
 code
  or problems, a lot of people don't seem to be interested in helping
  out,
  that's of course their choice, but maybe they don't seem to be aware
  the raspberry pi is often the motivation for starting to learn to
  program in
 Python. And as such such a reaction is a bit disappointing.
 Hi Jean,
 What makes you say that? Did you previously ask questions about
 Rasberry Pi code on this list?
 It was not about code but about python-coding in IDLE (that's the
 default on raspbian):
 I started a thread [newbie] starting geany from within idle does not
 work both here and in the raspberry pi forum. I just wondered why I
 never got an answer concerning that topic.
 
 If you did I wouldn't have answered those questions because I've never
 used a Raspberry Pi and know nothing about them (except that they
 encourage using Python somehow). I think that there's actually a list
 that is specifically for Raspberry Pi Python questions that might be
 more helpful although I don't know what it is...
 Here is the url to that forum
 
 http://www.raspberrypi.org/forum/
 
 kind regards,
 jean

Personally  use Geany  stand alone and not under idle, pressing F5 should 
save  run the code you are currently editing. Would running under idle 
give any other benefits? 



-- 
Cheese -- milk's leap toward immortality.
-- Clifton Fadiman, Any Number Can Play
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: [newbie] advice and comment wanted on first tkinter program

2014-01-19 Thread Jean Dupont
Op zaterdag 18 januari 2014 16:12:41 UTC+1 schreef Oscar Benjamin:
 On 18 January 2014 14:52, Jean Dupont jeandupont...@gmail.com wrote:
 
  Thanks Peter and Terry Jan for the useful suggestions. One thing which I 
 find a bit weird: when asking for Python-help concerning raspberry pi code 
  or problems, a lot of people don't seem to be interested in helping out, 
  that's of course their choice, but maybe they don't seem to be aware the 
  raspberry pi is often the motivation for starting to learn to program in 
 Python. And as such such a reaction is a bit disappointing.
 Hi Jean,
 What makes you say that? Did you previously ask questions about
 Rasberry Pi code on this list?
It was not about code but about python-coding in IDLE (that's the default
on raspbian):
I started a thread [newbie] starting geany from within idle does not
work both here and in the raspberry pi forum. I just wondered why I never
got an answer concerning that topic.

 If you did I wouldn't have answered those questions because I've never
 used a Raspberry Pi and know nothing about them (except that they
 encourage using Python somehow). I think that there's actually a list
 that is specifically for Raspberry Pi Python questions that might be
 more helpful although I don't know what it is...
Here is the url to that forum

http://www.raspberrypi.org/forum/

kind regards,
jean
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: [newbie] advice and comment wanted on first tkinter program

2014-01-19 Thread Chris Angelico
On Mon, Jan 20, 2014 at 3:04 PM, Jean Dupont jeandupont...@gmail.com wrote:
 I started a thread [newbie] starting geany from within idle does not
 work both here and in the raspberry pi forum. I just wondered why I never
 got an answer concerning that topic.

I saw that thread. It looked like a R-Pi problem, not a Python one, so
I didn't respond because I don't have an R-Pi. If you get no response
on the R-Pi forum, you might want to see if you can duplicate the
issue on a desktop computer - preferably on Win/Mac/Lin, as those are
the platforms most people use. That, with exact steps to repro (which
it looks like you gave for the R-Pi, though again I can't verify),
would get some interest.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: [newbie] advice and comment wanted on first tkinter program

2014-01-18 Thread Jean Dupont
Op vrijdag 17 januari 2014 22:40:42 UTC+1 schreef Terry Reedy:
 On 1/17/2014 8:20 AM, Jean Dupont wrote:
 
  Dear all,
 
  I made a simple gui with tkinter. I can imagine there are things which I
 
  did which are not optimal. So what I ask is to comment on my code
 
  preferable with snippets of code which show how to do improve my code.
 
  #!/usr/bin/env python
 
  import Tkinter
 
 
 
 1. import Tkinter as tk
 
 
 
 Besides saving a bit of writing and reading time later, this makes any 
 
 future conversion to 3.x easier.
 
 
 
 import tkinter as tk
 
 
 
 2. add a few spaces to demarcate blocks of code.
 
 
 
  import time
 
  import RPi.GPIO as GPIO
 
 
 
 2. add a few spaces to demarcate blocks of code, such as here
 
 
 
  GPIO.setmode(GPIO.BOARD)
 
  GPIO.setup(26,GPIO.OUT)
 
  GPIO.setup(24,GPIO.OUT)
 
  #hardware : connect 2 leds:
 
  #board-pin 26 on/off led; control with buttons
 
  #board-pin 24 led with pwm dimming and frequency; control via sliders
 
 
 
 and here
 
 
 
  top = Tkinter.Tk()
 
  top.geometry(600x400+310+290)
 
 
 
 This looks strange somehow, but if it works...
 
 
 
 
 
  label1 = Label(top,relief=RAISED,bg =
 
  #EFF980,font=(Helvetica,14),height = 1, width = 15)
 
 
 
 In calls, put spaces after , but not before and after =.
 
 For other suggestions, see
 
 http://www.python.org/dev/peps/pep-0008/
 
 
 
 I suspect that the above is one line in your code and the bad wrapping a 
 
 result of mis-spacing. The following is also one line, but easer to read 
 
 as spaces separate argument chunks
 
 
 
 label1 = Label(top, relief=RAISED, bg=#EFF980, font=(Helvetica,14), 
 
 height=1, width=15)
 
 
 
 and the wrapping, if any, does not break up an arg chunk.
 
 
 
 Some people advocate defining an App class, but Tk and tkinter, even 
 
 though object method based, allow the straightforward imperative style 
 
 you have used.
 
 
 
 I agree with Peter: First and foremost a program has to do what the 
 
 author wants it to do. Everything else is secondary. But a bit of 
 
 styling will make reading and changing easier.
 
 
 
 -- 
 
 Terry Jan Reedy

Thanks Peter and Terry Jan for the useful suggestions. One thing which I find a 
bit weird: when asking for Python-help concerning raspberry pi code or 
problems, a lot of people don't seem to be interested in helping out, that's of 
course their choice, but maybe they don't seem to be aware the raspberry pi is 
often the motivation for starting to learn to program in Python. And as such 
such a reaction is a bit disappointing.

kind regards,
jean
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: [newbie] advice and comment wanted on first tkinter program

2014-01-18 Thread Oscar Benjamin
On 18 January 2014 14:52, Jean Dupont jeandupont...@gmail.com wrote:

 Thanks Peter and Terry Jan for the useful suggestions. One thing which I find 
 a bit weird: when asking for Python-help concerning raspberry pi code or 
 problems, a lot of people don't seem to be interested in helping out, that's 
 of course their choice, but maybe they don't seem to be aware the raspberry 
 pi is often the motivation for starting to learn to program in Python. And as 
 such such a reaction is a bit disappointing.

Hi Jean,

What makes you say that? Did you previously ask questions about
Rasberry Pi code on this list?

If you did I wouldn't have answered those questions because I've never
used a Raspberry Pi and know nothing about them (except that they
encourage using Python somehow). I think that there's actually a list
that is specifically for Raspberry Pi Python questions that might be
more helpful although I don't know what it is...


Oscar
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: [newbie] advice and comment wanted on first tkinter program

2014-01-18 Thread Mark Lawrence

On 18/01/2014 15:12, Oscar Benjamin wrote:

On 18 January 2014 14:52, Jean Dupont jeandupont...@gmail.com wrote:


Thanks Peter and Terry Jan for the useful suggestions. One thing which I find a 
bit weird: when asking for Python-help concerning raspberry pi code or 
problems, a lot of people don't seem to be interested in helping out, that's of 
course their choice, but maybe they don't seem to be aware the raspberry pi is 
often the motivation for starting to learn to program in Python. And as such 
such a reaction is a bit disappointing.


Hi Jean,

What makes you say that? Did you previously ask questions about
Rasberry Pi code on this list?

If you did I wouldn't have answered those questions because I've never
used a Raspberry Pi and know nothing about them (except that they
encourage using Python somehow). I think that there's actually a list
that is specifically for Raspberry Pi Python questions that might be
more helpful although I don't know what it is...


Oscar



As Python is meant to be cross platform i think it's pretty much 
irrelevant that Raspberry Pi is mentioned.  It's far more likely that 
people don't respond as questions are asked about specific libraries 
which they haven't used.


Neither does it help when considering Jean's last post that the final 
paragraph shows as one line in Thunderbird on Windows and over 60% is 
simply blank lines.  No guesses as to how he's posting.


--
My fellow Pythonistas, ask not what our language can do for you, ask 
what you can do for our language.


Mark Lawrence

--
https://mail.python.org/mailman/listinfo/python-list


Re[2]: [newbie] advice and comment wanted on first tkinter program

2014-01-18 Thread Grawburg
The Raspberry Pi is exactly what got me started with Python. I'm at 
medium-sized science museum and used the Pi, Python,  tkinter to introduce 
kids to programming  Linux this past summer.

Jean, feel free to contact me off-line for my experience with all three.


Brian Grawburg
Wilson, NC


-Original Message- 
 From: Oscar Benjamin oscar.j.benja...@gmail.com 
 To: Jean Dupont jeandupont...@gmail.com 
 Cc: Python List python-list@python.org 
 Date: 01/18/14 10:13 AM 
 Subject: Re: [newbie] advice and comment wanted on first tkinter program 
 
 On 18 January 2014 14:52, Jean Dupont jeandupont...@gmail.com wrote:
 
  Thanks Peter and Terry Jan for the useful suggestions. One thing which I 
  find a bit weird: when asking for Python-help concerning raspberry pi code 
  or problems, a lot of people don't seem to be interested in helping out, 
  that's of course their choice, but maybe they don't seem to be aware the 
  raspberry pi is often the motivation for starting to learn to program in 
  Python. And as such such a reaction is a bit disappointing.
 
 Hi Jean,
 
 What makes you say that? Did you previously ask questions about
 Rasberry Pi code on this list?
 
 If you did I wouldn't have answered those questions because I've never
 used a Raspberry Pi and know nothing about them (except that they
 encourage using Python somehow). I think that there's actually a list
 that is specifically for Raspberry Pi Python questions that might be
 more helpful although I don't know what it is...
 
 
 Oscar
 -- 
 https://mail.python.org/mailman/listinfo/python-list

-- 
The truth will set you free . . .but first it will infuriate you.




-- 
https://mail.python.org/mailman/listinfo/python-list


[newbie] advice and comment wanted on first tkinter program

2014-01-17 Thread Jean Dupont
Dear all,
I made a simple gui with tkinter. I can imagine there are things which I
did which are not optimal. So what I ask is to comment on my code
preferable with snippets of code which show how to do improve my code.
#!/usr/bin/env python
import Tkinter
import time
import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BOARD)
GPIO.setup(26,GPIO.OUT)
GPIO.setup(24,GPIO.OUT)
#hardware : connect 2 leds:
#board-pin 26 on/off led; control with buttons
#board-pin 24 led with pwm dimming and frequency; control via sliders
top = Tkinter.Tk()
top.geometry(600x400+310+290)
var1 = DoubleVar()
var2 = DoubleVar()
i=0
p=GPIO.PWM(24,1)
p.start(50)
def btn_on_cmd():
text3.configure(bg = #00FF00)
text3.delete(0.1,END)
text3.insert(0.1,ON )
GPIO.output(26,True)
def btn_off_cmd():
text3.configure(bg = #FF4000)
text3.delete(0.1,END)
text3.insert(0.1,OFF)   
GPIO.output(26, False)
def timer0():
global i
i=i+1
text1.delete(0.1,END)
text1.insert(4.2,Timer:  + str(i))
label1.configure(text=time.strftime(%H:%M:%S))
top.after(1000, timer0)
def Set_PWM(var1):
DC = float(var1)
p.ChangeDutyCycle(DC)
def Set_FREQ(var2):
FR = float(var2)
p.ChangeFrequency(FR)   
btn_on = Button(top, text =On, command = btn_on_cmd)
btn_on.place(x=10,y=100)
btn_off = Button(top, text =Off, command = btn_off_cmd)
btn_off.place(x=100,y=100)
text1 =Text(top, bg = #009BFF, font=(Helvetica,14), height = 1, width
= 15)
text1.place(x=5,y=5)
text3=Text(top, bg = red, font=(Helvetica,12),height = 1, width = 4) 
text3.place(x=60,y=60)
label1 = Label(top,relief=RAISED,bg =
#EFF980,font=(Helvetica,14),height = 1, width = 15)
label1.place(x=5,y=350)
label2= Label(top,relief=RAISED,bg =
#BFBFBF,font=(Helvetica,10),height = 1, text= Freq (Hz))
label2.place(x=420,y=320)
label3= Label(top,relief=RAISED,bg =
#BFBFBF,font=(Helvetica,10),height = 1, text= DC %)
label3.place(x=520,y=320)
slider1 = Scale(top,variable = var1,length = 300,resolution = 1,command  =
Set_PWM)
slider1 = Scale(top,variable = var1,length = 300,resolution = 1,command  = 
Set_PWM)
slider1.place(x=500,y=5)
slider1.set(50)
slider2 = Scale(top,variable = var2,length = 300,from_= 0.1, to = 50,resolution 
= 0.1,command  = Set_FREQ)
slider2.place(x=400,y=5)
slider2.set(2)
timer0()
top.mainloop()
GPIO.cleanup()


thanks in advance 
jean

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: [newbie] advice and comment wanted on first tkinter program

2014-01-17 Thread Peter Otten
Jean Dupont wrote:

 Dear all,
 I made a simple gui with tkinter. I can imagine there are things which I
 did which are not optimal. So what I ask is to comment on my code
 preferable with snippets of code which show how to do improve my code.
 #!/usr/bin/env python
 import Tkinter
 import time
 import RPi.GPIO as GPIO
 GPIO.setmode(GPIO.BOARD)
 GPIO.setup(26,GPIO.OUT)
 GPIO.setup(24,GPIO.OUT)
 #hardware : connect 2 leds:
 #board-pin 26 on/off led; control with buttons
 #board-pin 24 led with pwm dimming and frequency; control via sliders
 top = Tkinter.Tk()
 top.geometry(600x400+310+290)
 var1 = DoubleVar()
 var2 = DoubleVar()
 i=0
 p=GPIO.PWM(24,1)
 p.start(50)
 def btn_on_cmd():
 text3.configure(bg = #00FF00)
 text3.delete(0.1,END)
 text3.insert(0.1,ON )
 GPIO.output(26,True)
 def btn_off_cmd():
 text3.configure(bg = #FF4000)
 text3.delete(0.1,END)
 text3.insert(0.1,OFF)
 GPIO.output(26, False)
 def timer0():
 global i
 i=i+1
 text1.delete(0.1,END)
 text1.insert(4.2,Timer:  + str(i))
 label1.configure(text=time.strftime(%H:%M:%S))
 top.after(1000, timer0)
 def Set_PWM(var1):
 DC = float(var1)
 p.ChangeDutyCycle(DC)
 def Set_FREQ(var2):
 FR = float(var2)
 p.ChangeFrequency(FR)
 btn_on = Button(top, text =On, command = btn_on_cmd)
 btn_on.place(x=10,y=100)
 btn_off = Button(top, text =Off, command = btn_off_cmd)
 btn_off.place(x=100,y=100)
 text1 =Text(top, bg = #009BFF, font=(Helvetica,14), height = 1, width
 = 15)
 text1.place(x=5,y=5)
 text3=Text(top, bg = red, font=(Helvetica,12),height = 1, width = 4)
 text3.place(x=60,y=60)
 label1 = Label(top,relief=RAISED,bg =
 #EFF980,font=(Helvetica,14),height = 1, width = 15)
 label1.place(x=5,y=350)
 label2= Label(top,relief=RAISED,bg =
 #BFBFBF,font=(Helvetica,10),height = 1, text= Freq (Hz))
 label2.place(x=420,y=320)
 label3= Label(top,relief=RAISED,bg =
 #BFBFBF,font=(Helvetica,10),height = 1, text= DC %)
 label3.place(x=520,y=320)
 slider1 = Scale(top,variable = var1,length = 300,resolution = 1,command  =
 Set_PWM)
 slider1 = Scale(top,variable = var1,length = 300,resolution = 1,command  =
 Set_PWM) slider1.place(x=500,y=5)
 slider1.set(50)
 slider2 = Scale(top,variable = var2,length = 300,from_= 0.1, to =
 50,resolution = 0.1,command  = Set_FREQ) slider2.place(x=400,y=5)
 slider2.set(2)
 timer0()
 top.mainloop()
 GPIO.cleanup()
 
 
 thanks in advance
 jean

First and foremost a program has to do what the author wants it to do. 
Everything else is secondary. You are likely to have such a program on your 
machine, so congrats :)

However, the version you posted does not run, probably because you started 
to replace

from Tkinter import *
top = Tk()
...
var1 = DoubleVar()

with the -- better --

import Tkinter
top = Tkinter.Tk()
...

but stopped too early, so that the line

var1 = DoubleVar

will raise a NameError. The fix is mechanical: run the program, go to the 
line with the NameError and add the 'Tkinter.' prefix.

Once you have done that you should take the time to find good variable 
names. var1? I have no idea what value that could hold until I've read the 
whole program. That's feasible here, but program size may grow over time, 
and can you still tell me what var1 means next week? I recommend names that 
reflect the problem domain, e. g. `var_dutycycle` or just `dutycycle`.

Next you should consider grouping the code by topic -- not necessarily into 
functions; having a section that does the setup for the dutycycle data and 
widgets and one for the time etc., visually separated by one or two empty 
lines should be sufficient.

If you're ambitious you should read up on the grid layout manager. I allows 
widget size to change depending on the window size.

The Text widget can be used to write whole Editors (like IDLE) -- it does no 
harm here, but seems a bit heavyweight for just an On/Off display. I would 
go with a Label or Entry. 

What does a red widget with no text mean, by the way? On, off, or undefined?
Personally, I like to start with a defined state. An easy way to achieve 
this is to call 

button_off_cmd() # or button_on_cmd()

manually before your program enters the mainloop() -- just like you did with 
timer0().

PS: An easy way to get an idea of what a script does is to run it. I'd guess 
that by keeping the Rasperry-Pi-specific code in you are reducing the number 
of readers who can do that by a few orders of magnitude. I managed to get it 
to run with the following ad-hoc changes:

$ diff -u raspberry_orig.py raspberry_mock.py
--- raspberry_orig.py   2014-01-17 16:10:20.843334832 +0100
+++ raspberry_mock.py   2014-01-17 16:10:58.970855503 +0100
@@ -1,7 +1,36 @@
 #!/usr/bin/env python
 import Tkinter
+from Tkinter import *
 import time
-import RPi.GPIO as GPIO
+
+try:
+import RPi.GPIO as GPIO
+except ImportError:
+class Name(str):
+def __repr__(self):
+return self

Re: [newbie] advice and comment wanted on first tkinter program

2014-01-17 Thread Terry Reedy

On 1/17/2014 8:20 AM, Jean Dupont wrote:

Dear all,
I made a simple gui with tkinter. I can imagine there are things which I
did which are not optimal. So what I ask is to comment on my code
preferable with snippets of code which show how to do improve my code.
#!/usr/bin/env python
import Tkinter


1. import Tkinter as tk

Besides saving a bit of writing and reading time later, this makes any 
future conversion to 3.x easier.


import tkinter as tk

2. add a few spaces to demarcate blocks of code.


import time
import RPi.GPIO as GPIO


2. add a few spaces to demarcate blocks of code, such as here


GPIO.setmode(GPIO.BOARD)
GPIO.setup(26,GPIO.OUT)
GPIO.setup(24,GPIO.OUT)
#hardware : connect 2 leds:
#board-pin 26 on/off led; control with buttons
#board-pin 24 led with pwm dimming and frequency; control via sliders


and here


top = Tkinter.Tk()
top.geometry(600x400+310+290)


This looks strange somehow, but if it works...



label1 = Label(top,relief=RAISED,bg =
#EFF980,font=(Helvetica,14),height = 1, width = 15)


In calls, put spaces after , but not before and after =.
For other suggestions, see
http://www.python.org/dev/peps/pep-0008/

I suspect that the above is one line in your code and the bad wrapping a 
result of mis-spacing. The following is also one line, but easer to read 
as spaces separate argument chunks


label1 = Label(top, relief=RAISED, bg=#EFF980, font=(Helvetica,14), 
height=1, width=15)


and the wrapping, if any, does not break up an arg chunk.

Some people advocate defining an App class, but Tk and tkinter, even 
though object method based, allow the straightforward imperative style 
you have used.


I agree with Peter: First and foremost a program has to do what the 
author wants it to do. Everything else is secondary. But a bit of 
styling will make reading and changing easier.


--
Terry Jan Reedy


--
https://mail.python.org/mailman/listinfo/python-list


Re: Newbie advice

2009-11-10 Thread lkcl
On Oct 29, 7:00 am, alex23 wuwe...@gmail.com wrote:

 However, if you're already comfortable with HTML/CSS, I'd recommend
 taking a look atPyjamas, which started as a port of the Google Web
 Toolkit, taking Python code and compiling it into javascript. The
 associated project,Pyjamas-Desktop, is a webkit-based desktop client/
 widget set; so ideally you only have to write one UI and it'll run
 both on the web  the desktop.

 Pyjamas:http://pyjs.org/
 Pyjamas-Desktop:http://pyjd.sourceforge.net/


 thank you for mentioning these, chris.  the information on pyjd is
slightly out-of-date.

 * pyjamas-desktop was merged into pyjamas as of the 0.6 release.

 * there are now three alternative back-ends for pyjamas-desktop,
   (just as there are three major web browser engines).  MSHTML,
   xulrunner and webkit.

   Opera's engine cannot be included because Opera's developers have
   not responded to invitations to provide an engine / library to
which
   python bindings can be added.  when they have provided python
bindings,
   a port of pyjd to use them can be done in approximately two weeks.

 * the webkit-based back-end is the least-recommended, due to
intransigence
   of the webkit developer, mark rowe.  mark rowe has shown consistent
   disrespect for free software contributions to make webkit with glib/
gobject
   bindings actually useful and useable, and has ensured that anyone
who
   wishes to proceed with getting webkit its glib/gobject bindings
will
   have an unacceptably hard time.  efforts to work with the other
webkit
   developers, which were proving successful, were deliberately
destroyed
   by, and terminated by, mark rowe.

 * the MSHTML-based back-end is surprisingly the most successful of
the
   three pyjd ports.  it requires _very_ little in the way of
libraries
   to be installed: only python-comtypes (at 250k) which is in
complete
   contrast to the other ports, which require whopping 30mbyte
installs
   of libraries and dependencies.

 * the xulrunner-based back-end is the best option for unix-based
systems.
   the design of xulrunner's core infrastructure, XPCOM, however, is
   slightly ... incomplete.  it is based on DCOM, but does not
provide
   the exact same capabilities as DCOM (no coclasses).  the upshot is
   that current releases of xulrunner work perfectly well for
_everything_
   but 2D SVG Canvas Image loading.  (i have a patch for xulrunner
which
   fixes this one single error)


so - it's a mixed and interesting bag of tricks.

full and comprehensive non-javascript bindings to web technology seems
to be a thoroughly misunderstood and underexploited area, with several
variations on the same theme being available from several competitive
sources.

the nice thing about pyjamas is that just as pyjs makes all the
differences go away when pyjamas apps are compiled to run in web
browsers, pyjamas-desktop makes those differences go away when
pyjamas apps are run as pure python on the desktop.

l.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Newbie advice

2009-10-29 Thread alex23
CSharpner csharp...@gmail.com wrote:
 Here's what I /want/ to do, but don't know where to begin:

Welcome to the fun :)

 - Write web services in Python (I've done plenty of this in .NET,
 BTW).

I'm a big fan of CherryPy: http://www.cherrypy.org/

It's very straightforward and easy to get into.

 - Write plain DLLs (is that even an option in Python (I told you I was
 a newb to Python, didn't I? :))

I'd recommend Cython: http://www.cython.org/

It allows you to write dlls in (a subset of) Python that are converted
to and compiled in C.

 - Write a web app (HTML front end, Python web services called from
 JavaScript).
 - Write a plain old web app with Python (no web services or Ajax, just
 plain HTML  Python).

Again, CherryPy, or depending on your needs one of the many, many web
frameworks; I'm partial to Turbogears, but Django seems to be the most
popular.

For a good overview of what's out there: 
http://wiki.python.org/moin/WebFrameworks

 - Is it possible to create a Windows client desktop GUI app with
 Python?  How?  How 'bout a Linux GUI app?

Python includes a wrapper around Tcl/Tk, which many consider to be
kinda ugly by modern standards, but is cross platform and part of the
stdlib (it's not always included with *nix distros by default but then
it's a lot easier to make that happen during install under most
package managers). PyQT, PyGtk and wxPython all have their active
proponents.

There are plenty of GUI libs out there: 
http://wiki.python.org/moin/GuiProgramming

However, if you're already comfortable with HTML/CSS, I'd recommend
taking a look at Pyjamas, which started as a port of the Google Web
Toolkit, taking Python code and compiling it into javascript. The
associated project, Pyjamas-Desktop, is a webkit-based desktop client/
widget set; so ideally you only have to write one UI and it'll run
both on the web  the desktop.

Pyjamas: http://pyjs.org/
Pyjamas-Desktop: http://pyjd.sourceforge.net/

 And finally, I'm not completely committed to using Windows to host my
 development either.  I'm willing to use Linux too (but would prefer
 Windows... at least to get started, until I'm comfortable enough with
 Python).

Google App Engine allows you to host our app on Google servers, with a
very generous free quota: http://code.google.com/appengine/

It supports Django and several other of the web frameworks. It's worth
noting that it uses the non-relational BigTable at the backend, which
seems to cause a lot of grief to relationally-trained minds :)

Hopefully something in here is enlightening :)
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Newbie advice

2009-10-29 Thread Diez B. Roggisch

CSharpner schrieb:

Alright, I'm not new to programming, but I'm diving in head first into
Python for the first time.  I'm running on Windows 7, just installed
Eclipse Java EE IDE for Web Developers and installed PyDev in it and
installed Python 2.6.  I've written my first Hello World program,
which simply displays Hello World! in the console output.

Here's what I /want/ to do, but don't know where to begin:

- Write web services in Python (I've done plenty of this in .NET,
BTW).


This depends. If by web services you mean generally HTTP-based RPC, 
such as JSON or XMLRPC - yes. If you talk about offering a SOAP-server, 
then Python is rather painful in that respect. Which partially is his 
(or his 3rd-party-libs) fault, but IMHO mostly because that whole 
standard is as crappy as it can get, and my personal experience told me 
to not expect interoperability from it anyway.




- Write plain DLLs (is that even an option in Python (I told you I was
a newb to Python, didn't I? :))


There is elmer: http://elmer.sourceforge.net/
And you can create COM servers with win32-extensions, and AFAIK 
IronPython allows you to create something like DLLs also.



- Write a web app (HTML front end, Python web services called from
JavaScript).


Plenty of options here, popular choices of frameworks include Django, 
TurboGears 1  2, Pylons, werkzeug, web.py and some more.



- Write a plain old web app with Python (no web services or Ajax, just
plain HTML  Python).


See above, just don't use AJAX


- Is it possible to create a Windows client desktop GUI app with
Python?  How?  How 'bout a Linux GUI app?


Both, with various toolkits such as Tk, Wx, Qt, GTK.



I don't know how to create and write a Python project with Eclipse to
tell it to be a web service or a web app, or if what I need to do in
the code to make as such, no run it from Eclipse to launch the app
in a web server and launch a browser automatically.  Can I debug after
doing this?  In other words, can I put break points in my web services
or web apps and go back into the IDE to step through the code for web
services and web apps?



First of all: in python, you don't code like in VisualStudio, with an 
application template wizard. You simply start coding. Some of the 
frameworks such as TurboGears and Django actually do have such wizards, 
but they aren't integrated into the IDE, and once you started, you don't 
automate anything further. And usually, this is a good thing - the 
wizard-stuff is for languages that need a lot of boilerplate. Python is 
quite successful in not needing that.


Debugging is certainly possible the way you want it, or at least close 
to that. I personally am satisfied with the built-in debugger, pdb. But 
PyDev comes with one that's supposed to be quite good as well, and 
winpdb is also deemed excellent.




Also, I'm not tied to Eclipse.  I'm totally open to other IDEs as
well.  SharpDevelop with the Python plugin looks interesting too.

And finally, I'm not completely committed to using Windows to host my
development either.  I'm willing to use Linux too (but would prefer
Windows... at least to get started, until I'm comfortable enough with
Python).


Cross-platform, especially within the web-world, is usually a no-brainer 
in python.


Diez
--
http://mail.python.org/mailman/listinfo/python-list


Re: Newbie advice

2009-10-29 Thread CSharpner
On Oct 29, 3:00 am, alex23 wuwe...@gmail.com wrote:
 CSharpner csharp...@gmail.com wrote:
  Here's what I /want/ to do, but don't know where to begin:

 Welcome to the fun :)

  - Write web services in Python (I've done plenty of this in .NET,
  BTW).

 I'm a big fan of CherryPy:http://www.cherrypy.org/

 It's very straightforward and easy to get into.

  - Write plain DLLs (is that even an option in Python (I told you I was
  a newb to Python, didn't I? :))

 I'd recommend Cython:http://www.cython.org/

 It allows you to write dlls in (a subset of) Python that are converted
 to and compiled in C.

  - Write a web app (HTML front end, Python web services called from
  JavaScript).
  - Write a plain old web app with Python (no web services or Ajax, just
  plain HTML  Python).

 Again, CherryPy, or depending on your needs one of the many, many web
 frameworks; I'm partial to Turbogears, but Django seems to be the most
 popular.

 For a good overview of what's out 
 there:http://wiki.python.org/moin/WebFrameworks

  - Is it possible to create a Windows client desktop GUI app with
  Python?  How?  How 'bout a Linux GUI app?

 Python includes a wrapper around Tcl/Tk, which many consider to be
 kinda ugly by modern standards, but is cross platform and part of the
 stdlib (it's not always included with *nix distros by default but then
 it's a lot easier to make that happen during install under most
 package managers). PyQT, PyGtk and wxPython all have their active
 proponents.

 There are plenty of GUI libs out 
 there:http://wiki.python.org/moin/GuiProgramming

 However, if you're already comfortable with HTML/CSS, I'd recommend
 taking a look at Pyjamas, which started as a port of the Google Web
 Toolkit, taking Python code and compiling it into javascript. The
 associated project, Pyjamas-Desktop, is a webkit-based desktop client/
 widget set; so ideally you only have to write one UI and it'll run
 both on the web  the desktop.

 Pyjamas:http://pyjs.org/
 Pyjamas-Desktop:http://pyjd.sourceforge.net/

  And finally, I'm not completely committed to using Windows to host my
  development either.  I'm willing to use Linux too (but would prefer
  Windows... at least to get started, until I'm comfortable enough with
  Python).

 Google App Engine allows you to host our app on Google servers, with a
 very generous free quota:http://code.google.com/appengine/

 It supports Django and several other of the web frameworks. It's worth
 noting that it uses the non-relational BigTable at the backend, which
 seems to cause a lot of grief to relationally-trained minds :)

 Hopefully something in here is enlightening :)

Thanks!  Lots of good stuff in there.  I think that's plenty to get me
started.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Newbie advice

2009-10-29 Thread CSharpner
On Oct 29, 4:25 am, Diez B. Roggisch de...@nospam.web.de wrote:
 CSharpner schrieb:

  Alright, I'm not new to programming, but I'm diving in head first into
  Python for the first time.  I'm running on Windows 7, just installed
  Eclipse Java EE IDE for Web Developers and installed PyDev in it and
  installed Python 2.6.  I've written my first Hello World program,
  which simply displays Hello World! in the console output.

  Here's what I /want/ to do, but don't know where to begin:

  - Write web services in Python (I've done plenty of this in .NET,
  BTW).

 This depends. If by web services you mean generally HTTP-based RPC,
 such as JSON or XMLRPC - yes. If you talk about offering a SOAP-server,
 then Python is rather painful in that respect. Which partially is his
 (or his 3rd-party-libs) fault, but IMHO mostly because that whole
 standard is as crappy as it can get, and my personal experience told me
 to not expect interoperability from it anyway.

  - Write plain DLLs (is that even an option in Python (I told you I was
  a newb to Python, didn't I? :))

 There is elmer:http://elmer.sourceforge.net/
 And you can create COM servers with win32-extensions, and AFAIK
 IronPython allows you to create something like DLLs also.

  - Write a web app (HTML front end, Python web services called from
  JavaScript).

 Plenty of options here, popular choices of frameworks include Django,
 TurboGears 1  2, Pylons, werkzeug, web.py and some more.

  - Write a plain old web app with Python (no web services or Ajax, just
  plain HTML  Python).

 See above, just don't use AJAX

  - Is it possible to create a Windows client desktop GUI app with
  Python?  How?  How 'bout a Linux GUI app?

 Both, with various toolkits such as Tk, Wx, Qt, GTK.



  I don't know how to create and write a Python project with Eclipse to
  tell it to be a web service or a web app, or if what I need to do in
  the code to make as such, no run it from Eclipse to launch the app
  in a web server and launch a browser automatically.  Can I debug after
  doing this?  In other words, can I put break points in my web services
  or web apps and go back into the IDE to step through the code for web
  services and web apps?

 First of all: in python, you don't code like in VisualStudio, with an
 application template wizard. You simply start coding. Some of the
 frameworks such as TurboGears and Django actually do have such wizards,
 but they aren't integrated into the IDE, and once you started, you don't
 automate anything further. And usually, this is a good thing - the
 wizard-stuff is for languages that need a lot of boilerplate. Python is
 quite successful in not needing that.

 Debugging is certainly possible the way you want it, or at least close
 to that. I personally am satisfied with the built-in debugger, pdb. But
 PyDev comes with one that's supposed to be quite good as well, and
 winpdb is also deemed excellent.



  Also, I'm not tied to Eclipse.  I'm totally open to other IDEs as
  well.  SharpDevelop with the Python plugin looks interesting too.

  And finally, I'm not completely committed to using Windows to host my
  development either.  I'm willing to use Linux too (but would prefer
  Windows... at least to get started, until I'm comfortable enough with
  Python).

 Cross-platform, especially within the web-world, is usually a no-brainer
 in python.

 Diez

Thanks Diez!  Both your and Alex's advice are a great help!
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Newbie advice

2009-10-29 Thread Bryan
On Oct 28, 9:53 pm, CSharpner csharp...@gmail.com wrote:
 Alright, I'm not new to programming, but I'm diving in head first into
 Python for the first time.  I'm running on Windows 7, just installed
 Eclipse Java EE IDE for Web Developers and installed PyDev in it and
 installed Python 2.6.  I've written my first Hello World program,
 which simply displays Hello World! in the console output.

 Here's what I /want/ to do, but don't know where to begin:

 - Write web services in Python (I've done plenty of this in .NET,
 BTW).
 - Write plain DLLs (is that even an option in Python (I told you I was
 a newb to Python, didn't I? :))
 - Write a web app (HTML front end, Python web services called from
 JavaScript).
 - Write a plain old web app with Python (no web services or Ajax, just
 plain HTML  Python).
 - Is it possible to create a Windows client desktop GUI app with
 Python?  How?  How 'bout a Linux GUI app?

 I don't know how to create and write a Python project with Eclipse to
 tell it to be a web service or a web app, or if what I need to do in
 the code to make as such, no run it from Eclipse to launch the app
 in a web server and launch a browser automatically.  Can I debug after
 doing this?  In other words, can I put break points in my web services
 or web apps and go back into the IDE to step through the code for web
 services and web apps?

 Also, I'm not tied to Eclipse.  I'm totally open to other IDEs as
 well.  SharpDevelop with the Python plugin looks interesting too.

 And finally, I'm not completely committed to using Windows to host my
 development either.  I'm willing to use Linux too (but would prefer
 Windows... at least to get started, until I'm comfortable enough with
 Python).

 TIA

I first started coding using Visual Studio + VB.net in college (not a
CS major).  I have now sworn off all that jazz for python+vim+*nix.
Your thinking reminds me very much of how I used to think about
solving problems with software.  I thought in terms of the tools I
had, which was basically which VS templates were available, which GUI
widget library I could buy, which MS application framework I could use
etc.

At some point I decided to start all over.  I started reading *basic*
computer programming books, teaching myself C, and doing all coding in
a simple text editor.  It was a tough period but I'm glad I went
through it because I think about programming completely differently
now.  Now a programming language is mostly an implementation detail.
I design the solution without even thinking about programming
languages or tools.  I choose to implement most solutions in python
because its syntax describes what I want to do the cleanest, its not
tied to a corporate strategy, it has tons of useful libraries bla bla
bla.

This post describes the IDS vs language divide that I crossed over:
http://osteele.com/archives/2004/11/ides

Python can do everything you ask in your post, and their are many
resources to help you do those things.  I just wanted to give you some
advice for the bigger picture.

Bryan
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Newbie advice

2009-10-29 Thread CSharpner
On Oct 29, 1:08 pm, Bryan bryanv...@gmail.com wrote:
 On Oct 28, 9:53 pm,CSharpnercsharp...@gmail.com wrote:



  Alright, I'm not new to programming, but I'm diving in head first into
  Python for the first time.  I'm running on Windows 7, just installed
  Eclipse Java EE IDE for Web Developers and installed PyDev in it and
  installed Python 2.6.  I've written my first Hello World program,
  which simply displays Hello World! in the console output.

  Here's what I /want/ to do, but don't know where to begin:

  - Write web services in Python (I've done plenty of this in .NET,
  BTW).
  - Write plain DLLs (is that even an option in Python (I told you I was
  a newb to Python, didn't I? :))
  - Write a web app (HTML front end, Python web services called from
  JavaScript).
  - Write a plain old web app with Python (no web services or Ajax, just
  plain HTML  Python).
  - Is it possible to create a Windows client desktop GUI app with
  Python?  How?  How 'bout a Linux GUI app?

  I don't know how to create and write a Python project with Eclipse to
  tell it to be a web service or a web app, or if what I need to do in
  the code to make as such, no run it from Eclipse to launch the app
  in a web server and launch a browser automatically.  Can I debug after
  doing this?  In other words, can I put break points in my web services
  or web apps and go back into the IDE to step through the code for web
  services and web apps?

  Also, I'm not tied to Eclipse.  I'm totally open to other IDEs as
  well.  SharpDevelop with the Python plugin looks interesting too.

  And finally, I'm not completely committed to using Windows to host my
  development either.  I'm willing to use Linux too (but would prefer
  Windows... at least to get started, until I'm comfortable enough with
  Python).

  TIA

 I first started coding using Visual Studio + VB.net in college (not a
 CS major).  I have now sworn off all that jazz for python+vim+*nix.
 Your thinking reminds me very much of how I used to think about
 solving problems with software.  I thought in terms of the tools I
 had, which was basically which VS templates were available, which GUI
 widget library I could buy, which MS application framework I could use
 etc.

 At some point I decided to start all over.  I started reading *basic*
 computer programming books, teaching myself C, and doing all coding in
 a simple text editor.  It was a tough period but I'm glad I went
 through it because I think about programming completely differently
 now.  Now a programming language is mostly an implementation detail.
 I design the solution without even thinking about programming
 languages or tools.  I choose to implement most solutions in python
 because its syntax describes what I want to do the cleanest, its not
 tied to a corporate strategy, it has tons of useful libraries bla bla
 bla.

 This post describes the IDS vs language divide that I crossed 
 over:http://osteele.com/archives/2004/11/ides

 Python can do everything you ask in your post, and their are many
 resources to help you do those things.  I just wanted to give you some
 advice for the bigger picture.

 Bryan

Thanks Bryan.  Though my post may have misled. I feel the same way.  I
started out on text editor source editing because that's all we had
back in the early 80's with the old 8-bits.  Actually, line editor
editing is what I started on... enter one line at a time and it's
entered... couldn't even cursor up and down...  Before I had an
assembler, I'd write assembly programs with /machine/ code, hex byte
by hex byte.  Was pretty cryptic by today's standards, but waaay fun.
Anyway, your points are right on and I'm glad to see you have moved in
this direction, though I'd encourage you not to dismiss tools that can
make your job easier too.  Take it from someone who went through all
of it from hex byte editing up through the latest IDEs:  You don't
want to forsake the tools that can reduce your workload.  You'll be
more valuable.  You don't want to be completely dependent on them
either, of course, but I know I don't have to tell you /that/ because
you're clearly not dependent on them.

My questions were more geared towards:  I know code isn't just a web
service because I will it and it doesn't connect with a browser
(for lack of a better term) because I wish it.  There are steps to be
taken to make those happen.  I'm merely querying what are they?.

Having said that and agreeing with your premise, I will say that after
having used dozens of languages, technologies, architectures, tools,
etc... over the last 27 years, at the end of the day, I have to
produce for the people paying me, so I won't /avoid/ tools, for
sure.  If there's anything I can use to get my product out earlier and/
or help produce more robust code and more maintainable code for the
folks that come in behind me, you can bet your favorite, sweet text
editor, I'll use a tool that improves my productivity, if there /is/
one. ;)  I won't want to 

Newbie advice

2009-10-28 Thread CSharpner
Alright, I'm not new to programming, but I'm diving in head first into
Python for the first time.  I'm running on Windows 7, just installed
Eclipse Java EE IDE for Web Developers and installed PyDev in it and
installed Python 2.6.  I've written my first Hello World program,
which simply displays Hello World! in the console output.

Here's what I /want/ to do, but don't know where to begin:

- Write web services in Python (I've done plenty of this in .NET,
BTW).
- Write plain DLLs (is that even an option in Python (I told you I was
a newb to Python, didn't I? :))
- Write a web app (HTML front end, Python web services called from
JavaScript).
- Write a plain old web app with Python (no web services or Ajax, just
plain HTML  Python).
- Is it possible to create a Windows client desktop GUI app with
Python?  How?  How 'bout a Linux GUI app?

I don't know how to create and write a Python project with Eclipse to
tell it to be a web service or a web app, or if what I need to do in
the code to make as such, no run it from Eclipse to launch the app
in a web server and launch a browser automatically.  Can I debug after
doing this?  In other words, can I put break points in my web services
or web apps and go back into the IDE to step through the code for web
services and web apps?

Also, I'm not tied to Eclipse.  I'm totally open to other IDEs as
well.  SharpDevelop with the Python plugin looks interesting too.

And finally, I'm not completely committed to using Windows to host my
development either.  I'm willing to use Linux too (but would prefer
Windows... at least to get started, until I'm comfortable enough with
Python).

TIA
-- 
http://mail.python.org/mailman/listinfo/python-list