Dick Moores wrote:
I have a bunch of functions I've collected in one script, mycalc.py,
which I use as a module, mycalc. The last one I wrote, cmpSeq() is as
follows:
[code]
In a script, cmpSeq() works fine. For example followed by
[example]
The output is:
[output]
cmpSeq() is now
I have copied the following example from Learning to Program by
Alan
Gauld (section: Event Driven Programming). To run it on Linux
(Redhat 8.0; Python 2.4) the tutorial says to replace 'msvcrt'
with 'curses.stdscr'.
I thought I'd fixed that fault.
The sequence should be:
import
Dick,
I can't see a problem but I notice an inconsistency below:
#testof_cmpSeq.py
import mycalc
which produces:
Traceback (most recent call last):
File C:\Python24\MyScripts\testof_cmpSeq.py, line 1,
in -toplevel-
from mycalc import cmpSeq
ImportError: cannot import name cmpSeq
Hi Dan,
I think you need to back up a little and build the program piece by
piece.
i am making a simple script to get the hang of Tkinter.
The script is quite complex for a starter. You could focus down on
just
a single control initially, the area button. Get that to pop up the
dialog
and
Alan,
Sorry of course that is the problem. These pages are
password protected
Is it possible to download password protected pages (I
know the password but I don't how to get the program
to use it).
David
--- Alan G [EMAIL PROTECTED] wrote:
It runs fine but the file saved to disk is the
Sorry of course that is the problem. These pages are
password protected
Is it possible to download password protected pages (I
know the password but I don't how to get the program
to use it).
That will depend on how the protection is implemented.
If your server is a J2EE box with full
Dear Danny
Hi,
Many thanks for your help and especially the references in your
reply. Now the code works fine.
BTW, I had to replace ky = msvcrt.getch() with
ky = chr(msvcrt.getch()).
Regards,
Hossein
On Mon, 8 Aug 2005, Danny Yoo [EMAIL PROTECTED] wrote:
On Mon, 8 Aug 2005,
List,
I'm running a program I wrote which I've run a number of times before,
successfully.
I use the following statement to fix the problem of utf-8 codes which blow
up a later part of my production process that I cannot fix:
trans_table =
Alan G wrote at 00:42 8/9/2005:
Dick,
I can't see a problem but I notice an inconsistency below:
#testof_cmpSeq.py
import mycalc
which produces:
Traceback (most recent call last):
File C:\Python24\MyScripts\testof_cmpSeq.py, line 1, in -toplevel-
from mycalc import cmpSeq
ImportError:
Hello,
I'm having this issue with Tkinter. I have a frame with all my buttons,
checkboxes et al, and all is working fine. I want to add menus and added the
following to my frame (fCanvas) code:
# create a toplevel menu
menu = Menu(fCanvas)
fCanvas.config(menu=menu)
# create a
I tried deleting a mycalc.pyc that had been created and the problem
cleared up! If I remember correctly, for a while I had moved
mycalc.py to another folder in PYTHONPATH (I had recently learned
how to modify PYTHONPATH in Win XP), and the .pyc was in this
folder. Sorry I don't remember
On 8/9/05, Tom Cloyd [EMAIL PROTECTED] wrote:
print len('()ÄäÀÁàáÇçÈÉèéÌÍìíÑñÒÓòóÙÚúù')
print len('--AaAAaaCcEEeeIIiiNnOOooUUuu')
the result:
54
28
I'm completely mystified by this. All of it. None of it makes sense. This
program was working fine. Now it doesn't. And those two
Alan G wrote at 03:22 8/9/2005:
I tried deleting a mycalc.pyc that had been created and the problem
cleared up! If I remember correctly, for a while I had moved mycalc.py
to another folder in PYTHONPATH (I had recently learned how to modify
PYTHONPATH in Win XP), and the .pyc was in this
David Holland wrote:
Alan,
Sorry of course that is the problem. These pages are
password protected
Is it possible to download password protected pages (I
know the password but I don't how to get the program
to use it).
urllib2 supports basic and digest authentication. There ale
Jorge Louis De Castro wrote:
Hello,
I'm having this issue with Tkinter. I have a frame with all my buttons,
checkboxes et al, and all is working fine. I want to add menus and added the
following to my frame (fCanvas) code:
# create a toplevel menu
menu = Menu(fCanvas)
Hello.
I need to run a program
(http://www.microsoft.com/ntserver/nts/downloads/management/uptime/default.asp)
thru Python. It is normally run such as uptime AUTO-SRV-001 /s
/d:04/01/2005 in the command prompt. Is it possible to run a already
compiled exe file in Python and thereafter get the
Win XP. Python2.4.
Javier Ruere suggested getting PyChecker or PyLint. I found PyChecker and
put the pychecker-0.8.14 folder in
C:\Python24\Lib\site-packages\PyChecker. I don't really know what I'm
doing (obviously?), but I added
Dear Alan
Hi,
First of all let me thank you very much for that excellent
tutorial. As a Python beginner, I learned many things from that.
As I have mentioned in my previous message to this list, in
that example I had to replace ky = msvcrt.getch() with
ky = chr(msvcrt.getch()).
import commands
commands.getoutput(uptime AUTO-SRV-001 /s /d:04/01/2005)
that should do itOn 8/9/05, Øyvind [EMAIL PROTECTED] wrote:
Hello.I need to run a program(http://www.microsoft.com/ntserver/nts/downloads/management/uptime/default.asp)thru Python. It is normally run such as uptime
Brian van den Broek wrote:
Say you go with your method of defining a deck (cards above) and then
making random choices from it. Try something like this (untested code):
cards = [Ace of ...,] # As above
cards_dealt = []
def get_card():
while True:
new_card =
Thanks a lot. However, it didn't work. I got an error stating something
along: Is not recognized as an internal or external command, executable
program or .. file (I don't know how to translate the word . to
english).
But, when I looked in the manual about the commands module, I found
Øyvind wrote:
Hello.
I need to run a program
(http://www.microsoft.com/ntserver/nts/downloads/management/uptime/default.asp)
thru Python. It is normally run such as uptime AUTO-SRV-001 /s
/d:04/01/2005 in the command prompt. Is it possible to run a already
compiled exe file in Python and
On 8/9/05, Øyvind [EMAIL PROTECTED] wrote:
Thanks a lot. However, it didn't work. I got an error stating something
along: Is not recognized as an internal or external command, executable
program or .. file (I don't know how to translate the word . to
english).
That looks like a
oliver wrote:
On 8/9/05, Øyvind [EMAIL PROTECTED] wrote:
Thanks a lot. However, it didn't work. I got an error stating something
along: Is not recognized as an internal or external command, executable
program or .. file (I don't know how to translate the word . to
english).
That
I had a look at urllib2 and I found this example :-
import urllib2
# Create an OpenerDirector with support for Basic HTTP
Authentication...
auth_handler = urllib2.HTTPBasicAuthHandler()
auth_handler.add_password('realm', 'host', 'username',
'password')
opener = urllib2.build_opener(auth_handler)
Kent Johnson wrote at 06:13 8/9/2005:
Dick Moores wrote:
Win XP. Python2.4.
Javier Ruere suggested getting PyChecker or PyLint. I found PyChecker
and
put the pychecker-0.8.14 folder in
C:\Python24\Lib\site-packages\PyChecker. I don't really know what I'm
doing (obviously?), but I
Ah, sorry. Here is the definition of fCanvas:
class LogAnalyzerGUI(Frame):
def __init__(self, parent=0):
Frame.__init__(self, parent)
self.type = 2
self.terms = 0
self.master.title('XML Analyzer')
self.buildUI()
def buildUI(self):
fCanvas = Frame(self)
Ron Phillips wrote:
I am expecting users to cut-and-paste DMS data into an application —
like: +40 30 15 E40 15 34.56, -81 0 0, 81 57 34.27E, W 40° 13’
27.343”, 40° 13’ 27.343” S, 140° 13’ 27.343”S, S40° 13’ 27.34454,
81:57:34.27E
I've been able to write a regex that seems to
Got it!
Because 'menu' is a config option of the top level window's config but not
of 'Frame', It's just a matter of calling self.master.config(menu=menu)
Thanks
j.
From: Kent Johnson [EMAIL PROTECTED]
To: Python Tutor tutor@python.org
Subject: Re: [Tutor] Tkinter Menus
Date: Tue, 09 Aug 2005
ky = chr(msvcrt.getch()). The other problem is that when
the program is finished the previous terminal state is not
restored (I am using xterm on Linux).
Yep, and that applies to my cygwin terminal too. I think there
is a setty command you can issue that fixres this but since I
hardly ever
Hey all,
I just fixed it so that it prints. The problem was that it returned the
cards instead of printing them.
Nathan
---
Early to bed,
Early to rise,
Makes a man healthy, wealthy, and wise.
--Benjamin Franklin
Hey all,
I marked it off-topic, but it is necessary to mail this to the mailing
list. People asked questions when I first put up my blackjack game(the beginning
code of it anyway), so here is a site that has the rules of card games, since
I'll be writing them on Python.
It's
Michael and List,
You suggestion (see foot of email trail, below) is a bit over my head. As
I stated, I removed ActivePython 2.4.1 installed Python 2.4.1 from
python.org, and now my program doesn't work, where before it did. I don't
understand this. When isn't Python 2.4.1 == Python 2.4.1?
hi all,
just wanted to announce my next public Python course. it's
a 3-day course held near the San Francisco airport. please
sign up quickly as there are only 10 more open spots! let
me know if you have any questions.
the website is http://cyberwebconsulting.com (click Python
training), but
Thanks Luke. You've helped me out of a jam that I was going to ask without
even asking.
Nathan
---Early to
bed,Early to rise,Makes a man healthy, wealthy, and wise.--Benjamin
ok. i know python and want to turn all my programs i made when i was learning python into Tkinter programs. i dont know how to make if satments and display the output like this in python:
if cmd == quit:
print press exit to quit
i have no idea how to do that in Tkinter please help.
Nathan Pinno said unto the world upon 2005-08-09 17:35:
It printed 25.973 as the result.
snip
I don't think I got the math wrong. My thinking is there are 52**6
ways to choose 6 items from 52 if you don't care about duplicates, and
52*51*50*49*48*47 ways to choose if you do. (The first
Quoting Dan Deternova [EMAIL PROTECTED]:
ok. i know python and want to turn all my programs i made when i was
learning python into Tkinter programs. i dont know how to make if
satments and display the output like this in python:
if cmd == quit:
print press exit to quit
i have no idea
I coded the following just for fun:
import randomcool = ['Cool math!','Awesome!','Way to go!','Happy
problem solving!']while 1: start = raw_input("Do you
want to do some math? Yes or No") if start ==
"Yes": x = int(raw_input("First
number:")) y =
int(raw_input("Second number:"))
print
Here is the error:
Traceback (most recent call last): File
"D:\Python24\password.py", line 91, in -toplevel-
save_file(sitelist) File "D:\Python24\password.py", line 22, in
save_file for site,ID,passcard in
sitelist.items():ValueError: need more than 2 values to unpack
Here is the code:
Quoting Nathan Pinno [EMAIL PROTECTED]:
Here is the error:
Traceback (most recent call last):
File D:\Python24\password.py, line 91, in -toplevel-
save_file(sitelist)
File D:\Python24\password.py, line 22, in save_file
for site,ID,passcard in sitelist.items():
ValueError: need more
I think it means that I can't store the data as a dictionary unless I store
both the username and passcard as username|passcard. Am I right?
---
Early to bed,
Early to rise,
Makes a man healthy, wealthy, and wise.
--Benjamin Franklin
I tried fixing it. Here is the new code:
#This is for a password protected program to store passwords.
import getpass
password = hello
sitelist = {}
def load_file(pw):
import os
filename = 'passcard.txt'
if os.path.exists(filename):
store = open(filename,'r')
for line
Quoting Nathan Pinno [EMAIL PROTECTED]:
I tried fixing it. Here is the new code:
There are two likely places where you could have a problem: In your save
function, or in your load function. Have you tried looking at the file where it
saved the information? If the file doesn't contain the data
I fixed it. The problem was this line:
ID = line.strip().strip()
I fixed it so that it now reads:
ID = store.next().strip()
As a result, the program runs perfectly.
Nathan Pinno
---
Early to bed,
Early to rise,
Makes a man healthy,
Say I deal 5 cards, and then list them. How would I print the list of
cards, with the numbers of each card(the position in the list)? Then delete a
certain card or cards, based upon the user's choice?.
Nathan
---Early to
bed,Early
Nathan,
for site,ID,passcard in sitelist.items():
ValueError: need more than 2 values to unpack
The line is asking a dictionary (sitelist) to return 3 values
(site, ID and passcard) from its items() method. But A dictionary
stores things as name/value pairs so you can only get 2 items
back
Say I deal 5 cards, and then list them. How would I print the list of
cards, with the numbers of each card(the position in the list)? Then delete
a certain card or cards, based upon the user's choice?.
hope this points you in the right direction Nathan.
-Luke
#start of program
48 matches
Mail list logo