988 Posted Topics

Member Avatar for Mouche

I have to applaud your teacher for teaching Python rather than the usual "ugly syntax stuff" like C, C++ or Java. Colleges with their all too often ultra conservative teachers are just warming up to Python. So you and your teacher are way ahead! I will be playing around with …

Member Avatar for jrcagle
1
3K
Member Avatar for chris99

As far as I know only wxPython has a password option, the Tkinter Entry widget does not. An easy way to get around this, is to give the password entry widget a bg="yellow" and fg="white". This will be very hard to see for a bystander, as you type in the …

Member Avatar for Ene Uran
0
130
Member Avatar for Matt Tacular

There is a a Hardware section under DaniWeb TechTalk, that's were the experts are for this project of yours!

Member Avatar for Ene Uran
0
136
Member Avatar for slacke

[QUOTE=~s.o.s~;262041]@ slake Why stick to Borland ??? If you are thinking about compiler migration better go for the free Visual Studio 2005 free edition or for GCC mingw compiler which nowadays most of the people use.[/QUOTE] Why stick to Borland ??? Right on ~s.o.s~! Borland is a sinking ship! The …

Member Avatar for ~s.o.s~
0
235
Member Avatar for chris99

Works nicely, welcome to GUI programmig! You seemed to have learned quite a bit! Now, you can do a few cosmetic improvements, like making all the buttons the same sice and introducing some color. Just a matter of taste, but I would have lined up all the buttons on top …

Member Avatar for chris99
0
133
Member Avatar for briggs1987

If you want to use Tkinter to draw some shapes see: [url]http://www.daniweb.com/techtalkforums/post261377-80.html[/url] If you want to display a GIF image with Tkinter see: (for other image formats PIL works with Tkinter) [url]http://www.daniweb.com/code/snippet296.html[/url] If you want to plot a math function you can use VPython: [url]http://www.daniweb.com/code/snippet376.html[/url]

Member Avatar for Ene Uran
0
90
Member Avatar for The Dude

Only guys? Using a urinal was part of sorority pledge week! BTW, the guy I worked for during my summer job could in no way see what he was doing!

Member Avatar for Dani
0
69
Member Avatar for moussa.eltayeb

The rules of the Game of Life are wonderfully explained at: [url]http://www.math.com/students/wonders/life/life.html[/url]

Member Avatar for Ene Uran
0
82
Member Avatar for Ene Uran

I don't know how it is in your country, but in the good old USA election time is coming up. I will go to the voting place and look at the slate of sh*t, and whomever I vote for will be, you guess what. Any idea how to change things …

Member Avatar for happygeek
0
93
Member Avatar for Matt Tacular

How about a database of your senior class. Something you can search for names, phone numbers, addresses, hobbies, aspirations, favorite music and moviestar and so on. Do it right, and you could be a popular person. You could hand it out on graduation day to anyone that contributed. Hope your …

Member Avatar for Ene Uran
0
134
Member Avatar for dunderhead

In the case of: [code]import random random.randint(5) [/code]random is a module, and you are using the namespace random. Note that random is not a class! To find out if an object is a class use something like this: [code]import inspect if inspect.isclass(object_name): print "object_name is a class" [/code] Generally, Python …

Member Avatar for dunderhead
0
2K
Member Avatar for FireSBurnsmuP

The major difference between C++ and Python is that Python compiles source code to byte code and then interprets the byte code. There are programs that combine the byte code with the interpreter and package to an executable for distribution. More and more computers have Python already installed, so you …

Member Avatar for vegaseat
0
179
Member Avatar for etxulid

The integer is the smallest number in Python. [QUOTE]For the purpose of shift and mask operations, integers are assumed to have a binary, 2's complement notation using 32 or more bits, and hiding no bits from the user (i.e., all 4294967296 different bit patterns correspond to different values). [/QUOTE]

Member Avatar for vegaseat
0
219
Member Avatar for etxulid
Member Avatar for swapnamishra

I think we just had a discussion related to the same issue at: [url]http://www.daniweb.com/techtalkforums/thread55436.html[/url]

Member Avatar for Ene Uran
0
161
Member Avatar for jrcagle

Thanks Jeff, good observation! To bad the Python help never mentions that! If you insist on using fromkeys() you could use a tuple, adding two tuples forms a new tuple and there is no problem: [code]d = dict().fromkeys(range(1,10), ()) print d # {1: (), 2: (), 3: (), 4: (), …

Member Avatar for Ene Uran
1
136
Member Avatar for Gorilla

I use the DrPython IDE and that one allows me to set arguments like they would come from the command line. Take a look at: [url]http://www.daniweb.com/techtalkforums/post193207-50.html[/url] I have used a default argument under the else, particular for testing a program.

Member Avatar for Gorilla
0
132
Member Avatar for reRanger

Its me, Ene, note that each button ends up executing a function defined in the program. The button uses the command=function statement. The function is activated via its object (ie. just function rng), and not the usual function call (ie. would be rng() ). Also note that rng is not …

Member Avatar for reRanger
0
181
Member Avatar for Matt Tacular
Member Avatar for akadri

Take a look at this Python code snippet at: [url]http://www.daniweb.com/code/snippet360.html[/url] It uses a bitwise shift right operator to get the binary representation of an integer. Editor's note: I think we lost the reference when snippets were folded into the regular forum. Looks like Ene refers to ... [code]def denary2binary(n): '''convert …

Member Avatar for Ene Uran
0
179
Member Avatar for reRanger

Some C++ books like Deitel&Deitel are full with practice projects of this kind. You might want to post this question on the "C and C++" forum here. Some of the folks there are very helpful!

Member Avatar for Ene Uran
0
108
Member Avatar for msaenz

You need to give us more of your code, otherwise this will be an exercise in mind reading!

Member Avatar for msaenz
0
151
Member Avatar for reRanger

I took the liberty to modify vegaseat's previous example code to show you how buttons would work: [code]from Tkinter import * root = Tk() root.title("Press Button!") def show_image2(): canvas1.create_image(x, y, image=photo2) def show_image3(): canvas1.create_image(x, y, image=photo3) # pick three GIF image files you have in your working directory # image1 …

Member Avatar for reRanger
0
116
Member Avatar for MIGSoft

I guess I must be a geek, since I would rather use my computer to write programs and surf the net than watch TV.

Member Avatar for FireSBurnsmuP
0
966
Member Avatar for reRanger

I agree, Python is fun! Take a look at: [url]http://www.daniweb.com/techtalkforums/post225611-64.html[/url] You can modify this to fit your needs.

Member Avatar for reRanger
0
8K
Member Avatar for Peagles

This seems to work too: [code]a = unichr(88).encode('utf8') b = unichr(257).encode('utf8') c = unichr(109).encode('utf8') d = unichr(258).encode('utf8') print a,b,c,d e = a+b+c+d print e print for c in e: print c print for i in e.decode('utf8'): print ord(i) [/code]

Member Avatar for Ene Uran
0
1K
Member Avatar for chris99

Your or statements weren't written correctly. In this case it's simpler to see if the word is in a tuple (or list) of choices: [code]#1337 to Human dictionary: leet = { "1337": "l-EET/nReally Awesome", "noob": "(n00b) nOOb/nPerson who can't accept that s/he's wrong", "-xxors": "Suffix, pron: zors.\nUsed to accent an …

Member Avatar for ghostdog74
0
231
Member Avatar for chris99

Nice code so far! It would be easier on the user, if you only ask the user numbers to be entered once and then run the computer numbers against that! I like your compare, but there is a flaw. Lists [1,2,3,4,5,6] and [1,3,4,5,6,7] should have 5 matches, your compare would …

Member Avatar for vegaseat
0
131
Member Avatar for jan1024188

I think bash is a script language on Linux computers. I don't use Linux (yet), so I can't test it, but the program flow is easy to follow. The first part is a menu from which you select, and the second part is a case statement that activates a slected …

Member Avatar for jan1024188
0
145
Member Avatar for chris99

To make this song challenging you could change part of it: [code]def print_charlieVerse(): print "Charlie was a pidgeon, a pidgeon, a pidgeon." print "Charlie was a pidgeon, a pidgeon that flew." print "He flew in the morning, he flew in the night." print "And when he came home he was …

Member Avatar for Ene Uran
0
117
Member Avatar for chris99

Several problems with your program, I corrected some of them: [code]from Tkinter import * root = Tk() def hello(): print "Hello!" # removed unneeded arguments (metre,cm) def metres_to_centimetres(): metre = input("Put in a distance in metres: ") cm = metre*100 print "Distance in Centimetres = ",cm menubar = Menu(root) filemenu …

Member Avatar for chris99
0
143
Member Avatar for chris99

I think vegaseat meant "Projects for the Beginner" to be for the beginning programmer who understood the basics of Python and wanted to do something with that knowledge. It was probably not meant to be a tutorial, just projects with a few hints thrown in. You are right, why not …

Member Avatar for bumsfeld
0
139
Member Avatar for prinitor
Member Avatar for prinitor
0
118
Member Avatar for chris99

Just a few observations, hope you don't mind: 1) Python has True = 1 and False = 0 builtin 2) define your functions outside of the conditional if, or Python will redefine your functions whenever you take a test. This would slow down the program. The memory manager cleans up …

Member Avatar for Ene Uran
0
286
Member Avatar for chris99
Member Avatar for jrcagle

Lint Filters give warnings that are not always sensible. Using elif instead of all if is faster, since Python has to evaluate all the if, but stops at the first true elif condition. In your case it doesn't make much difference since you have a return statement, which will stop …

Member Avatar for Ene Uran
0
116
Member Avatar for Blujacker

You can use function sys.exc_info() to fetch the error created by my_program.py: [code]# save as my_file.py # executes a file my_program.py which has an error from Tkinter import* import sys root=Tk() text=Text() text.pack() try: execfile('my_program.py') except: error = "%s --> %s in file my_program.py"% (sys.exc_info()[0], sys.exc_info()[1]) # put error msg …

Member Avatar for Ene Uran
0
138
Member Avatar for Ene Uran

What is a closure? I keep reading this word in programming, but never got a good explanation.

Member Avatar for Ene Uran
0
286
Member Avatar for jrcagle
Member Avatar for jrcagle
0
3K
Member Avatar for Matt Tacular

Once you go to GUI programming, your approach has to change past just making labels. User actions are initiated by clicking on buttons, data is entered in an entry widget, results and messages can be displayed in labels. Get used to callback functions. Also, you might as well start a …

Member Avatar for vegaseat
0
213
Member Avatar for lekshmi200

Which web framework are you using? Any listed on: [url]http://wiki.python.org/moin/WebFrameworks[/url]

Member Avatar for Ene Uran
0
89
Member Avatar for Ginner

I think your trouble comes from the fact that Python itself actually has a module Queue. Rename your module MyQueue.py and it works just fine. This small code shows you all the modules Python has installed: [code]help("modules") [/code] To avoid conflicts give your own modules a prefix like "my"or "My".

Member Avatar for N317V
0
258
Member Avatar for swapnamishra
Member Avatar for biganimal

Wow! Your code is hard to read! See Dani's remarks at: [url]http://www.daniweb.com/techtalkforums/announcement114-3.html[/url] The common way to save data each time you use a program is to save it to a data file. Then bring in the latest saved data each time the program is run. If you want to save …

Member Avatar for Ene Uran
0
90
Member Avatar for Ene Uran
Member Avatar for Ene Uran
0
816
Member Avatar for Ene Uran

Is there a way to verify an exit, if you click on the exit symbol on a wxPython frame?

Member Avatar for Ene Uran
0
79
Member Avatar for msaenz

You mean something like that: [code]# write out each text containing line # (other than '\n') to a separate file str1 = """sentence one sentence two sentence three """ # write str1 to the test file fout = open("test.txt", "w") fout.write(str1) fout.close() # read the test file as a list …

Member Avatar for Ene Uran
0
119
Member Avatar for MIGSoft
Member Avatar for Ene Uran

Does Python have a module to display when a file has been last modified? Also, how do you get the file length?

Member Avatar for bumsfeld
0
669
Member Avatar for vegaseat

I have been in Las Vegas with some friends on the weekend, and the beer or shots are free as long as you play the penny slots. Of course, these folks want you to loosen up and waste your money on their machines or the tables.

Member Avatar for GriffIT34
0
420

The End.