4,305 Posted Topics

Member Avatar for soUPERMan
Member Avatar for apegram

The latest survey amongst graduating students indicates that job security ranks higher than job satisfaction.

Member Avatar for geekgoddess
1
242
Member Avatar for garyinspringhil

[B]print_cmd = 'echo "IN;PU" x "," y | lpr -P %s %s'[/B] should be written [B]print_cmd = 'echo "IN;PU%s,%s | lpr -P %s %s' % (x, y, printer, "")[/B] and later use [B]os.system(print_cmd)[/B]

Member Avatar for garyinspringhil
0
130
Member Avatar for ab_too

You simply form a new list excluding the item that contain a given substring ... [code]mylist = [ '192.168.255.1 00:01:02', '172.14.0.1 00:0f:01', '172.14.0.1 01:ff:dd:34', '192.168.255.3 00:dd:01:ff' ] exclude = '172.14.0.1' newlist = [] for item in mylist: if exclude not in item: newlist.append(item) print(newlist) """my result --> ['192.168.255.1 00:01:02', '192.168.255.3 …

Member Avatar for ab_too
0
717
Member Avatar for Clueless86

Talk about a lean and nimble IDE, I am still a friend of [B]ConText[/B]. You can set it to the language you are using, and even specify which version of Python you want to use. Best of all, I can run C, CPP, Ruby, Lua, IronPython and Python on it. …

Member Avatar for Stefano Mtangoo
0
322
Member Avatar for HiHe

Hope this link is correct, I am just getting used to Windows7: [url]http://www.daniweb.com/forums/post1158775.html#post1158775[/url]

Member Avatar for vegaseat
0
122
Member Avatar for soUPERMan

You mean a recursive function like this ... [code]def sum_digit_squares(intNum, total=0): """ return the sum of the squares of intNum digits """ if intNum > 0: last = intNum % 10 x = last**2 print( last, x ) # for testing only # recursive action return sum_digit_squares(intNum//10, total+x) else: return …

Member Avatar for willygstyle
0
1K
Member Avatar for JaxConer

Sometimes you have to ask 'stupid' questions to get smarter! We are glad to help. In your case [B]i[/B] is simply the name of a variable that holds the value as you iterate over a given range of numbers. You can use any allowed variable name, I usually use k …

Member Avatar for vegaseat
0
132
Member Avatar for pythonpro

I assume you have downloaded the installation programs for the correct version of Python. So the next question is: What is your operating system?

Member Avatar for vegaseat
0
88
Member Avatar for Whoever90
Member Avatar for bumsfeld
0
79
Member Avatar for MichelleCrews

Your military time has to be a 4 character numeric string of format hhmm. You can use function zfill() to pad with the proper amount of leading zeros. To extract the numbers for hh and mm respectively use string slicing. You should let your function return True or False to …

Member Avatar for snippsat
0
532
Member Avatar for kstmchick

[B](ranx, rany) >= button1(Point(x,y))[/B] is most likely not the same data type and therefore not comparable.

Member Avatar for vegaseat
0
417
Member Avatar for tzushky

Generally the eval() function will do ... [code]def add(x, y): return x + y input_str = raw_input("Enter add(4,3) ") print eval(input_str) """result for entering add(4,3) --> 7 """ [/code]... however, employ some checking so a nasty user does not wipe out your drive with an improper input.

Member Avatar for Gribouillis
0
372
Member Avatar for AnnetteM
Member Avatar for Lala2010

This might be a good example you can customize to your needs: [url]http://www.daniweb.com/forums/post1154551.html#post1154551[/url]

Member Avatar for vegaseat
0
129
Member Avatar for new_horizon

random.choice returns a random element of the list. Change your code [code] for i in range (0, No_trials): headlight = random.choice([headlight3, headlight1]) if headlight == headlight1: [/code]

Member Avatar for new_horizon
0
126
Member Avatar for Tech B

Your assumption about [B]graydata[/B] is probably correct if you just follow [B]GetImg()[/B] and [B]pImage[/B] in header file [B]loadbmp.h[/B] Are you passing [B]graydata[/B] in as a pointer?

Member Avatar for Tech B
0
457
Member Avatar for __qwerty__

You are trying to compare floating point numbers. The computer deals with floating point numbers internally in binary form. This leads to small roundoff errors. Just about all computer languages have that problem When you are calculating [B]b = b + 0.1[/B] by the time you get to [B]b = …

Member Avatar for __qwerty__
0
150
Member Avatar for nevets04

There is a code example that might help at: [url]http://www.daniweb.com/forums/post1146095.html#post1146095[/url]

Member Avatar for vegaseat
0
61
Member Avatar for persianprez

Try something like this ... [code]cs = ['CMSC 201','CMSC 202','CMSC 203','CMSC 304','CMSC 313', 'CMSC 331','CMSC 341','CMSC 345','CMSC 411','CMSC 421','CMSC 441'] math = ['MATH 151','MATH 152','MATH 221'] stat = ['STAT 355'] required = cs + math + stat # assume user entered this cmsc = ['CMSC 201','CMSC 202','CMSC 203','MATH 151'] for …

Member Avatar for vegaseat
0
91
Member Avatar for SoulMazer

There is also a good example of a wx.ListCtrl here: [url]http://www.daniweb.com/forums/post650657.html#post650657[/url] It shows you how to organize your data to load the widget and retrieve selected info.

Member Avatar for SoulMazer
0
171
Member Avatar for slmsatish

Oh my God! You are using a wild mix of [B]tabs[/B] and [B]spaces[/B] for your code indentations! That is an absolute [B]nono[/B]. Avoid tabs, since sooner or later you will mix them with spaces. Most Pythonians use 4 spaces for indenting a code block. Stick with that!

Member Avatar for snippsat
0
198
Member Avatar for soUPERMan

Hint ... [code]word = "python" for letter in word: index = word.find(letter) print( "letter %s is at index %s" % (letter, index) ) [/code]

Member Avatar for soUPERMan
0
4K
Member Avatar for AntonioLinux

I don't have module graphics.py, but your problem could be that you might have Button in that module, competing with Button from button.py This could be solved by using name-spaces.

Member Avatar for vegaseat
0
609
Member Avatar for johnnybgoode

Let's not forget Jython. Jython is an implementation of Python in Java. With it, you can embed Python directly into your Java applets and applications, or you can use Java classes in Python. Take a look at: [url]http://www.jython.org[/url]

Member Avatar for vegaseat
0
767
Member Avatar for csfriends

[QUOTE=jonsca;1150443]You missed the obvious option, jwenting. Open the skull, put black ink over the cortex, stamp it on a sheet of paper. Voila, brain fingerprinting.[/QUOTE]That wouldn't be [B]brain fingerprinting[/B] that would be [B]brain cortexprinting[/B]. You got to get a finger in there somewhere. :)

Member Avatar for peter_budo
-1
179
Member Avatar for camigirl4k3
Member Avatar for eva yang

Here you have an example of a class name [B]Animal[/B] and some instance names ([B]dog, cat, cow[/B]) ... [code]class Animal: """ class names by convention are capitalized """ # category is global to the class and is available to all # instances of class Animal category = "animal" def __init__(self, …

Member Avatar for eva yang
0
146
Member Avatar for [O3]

Also see: [url]http://www.daniweb.com/forums/post104834.html#post104834[/url]

Member Avatar for vegaseat
0
138
Member Avatar for Wraithmanilian

[QUOTE=customtshirts;1144687]Well i always like to prefer USA whether they win or lose. They are my all time favorite.[/QUOTE]I assume you are selling a t-shirt about that topic.

Member Avatar for vegaseat
0
143
Member Avatar for idreu2go4it

The simplest way to get your x values in small increments is with a while loop. Then simply append (y, x) tuples to a list and use the min() and max() functions.

Member Avatar for vegaseat
0
409
Member Avatar for Begjinner

[QUOTE=Tech B;1148423]... I just noticed 2 wasn't shown. Maybe I don't have it....[/QUOTE]A little simpler, and you might just have it ... [code]s = """ 2 6 18 22 """ s = s.split() i = 1 while i <= 26: if str(i) in s: print "gotcha" else: print str(i) i …

Member Avatar for Tech B
0
121
Member Avatar for Cyproz

[QUOTE=Cyproz;1147880]Ok i got the endswith and the startswith. but im not sure how to check for the @ symbol. so what method checks for a symbol?[/QUOTE]You are on the right track ... [code]def isValid(s): if "@" not in s: print "There is no @ symbol" return False if s.startswith("@"): print …

Member Avatar for vegaseat
0
120
Member Avatar for ArtphotoasiA

Someone at Google forgot to hand over the envelope of cash to make Italian justice work better.

Member Avatar for Lardmeister
0
190
Member Avatar for happygeek

Well, it wasn't that long ago: [url]http://www.daniweb.com/forums/thread12718.html[/url] I was still a C and BCX nut then. Amazing, BCX still exists: [url]http://bcx-basic.sourceforge.net/[/url]

Member Avatar for Dave Sinkula
0
524
Member Avatar for Kruptein

I don't see any reason why a space and number characters couldn't be added to your Polybius square.

Member Avatar for Kruptein
0
2K
Member Avatar for octopusgrabbus

The way you derive db_date, it clearly is a string. Your error comes from before that item. After all, sql_cmd = ... is just one line of code. Simply put all incoming_data[x] into str(incoming_data[x]) that should fix it.

Member Avatar for octopusgrabbus
0
340
Member Avatar for Programmer88

Take a look at the C code snippet at: [url]http://www.daniweb.com/code/snippet109.html[/url]

Member Avatar for pampres
-2
197
Member Avatar for baki100

Usually you can give your Python code a [B].pyw[/B] extension. This will use the [B]pythonw.exe[/B] interpreter avoiding the DOS console. If you create a distribution with py2exe then you have to make sure you specify windows in the setup ... [code]""" file = wx2exe.py Py2Exe (version 6.6 and higher) setup …

Member Avatar for baki100
0
983
Member Avatar for pyprog

A little playful ... [code]s = "knockknock" s2 = s.replace("knock", "bam", 1) print s2 s3 = s.replace("knock", "bam") print s3 s4 = s3.replace("bam", "knock", 1) print s4 # combine s3 and s4 action s5 = s.replace("knock", "bam").replace("bam", "knock", 1) print s5 """ my result --> bamknock bambam knockbam knockbam """ …

Member Avatar for vegaseat
0
103
Member Avatar for toll_booth

By default the buttons will appear on the root window. If you want them somewhere else, you have to specify the new master.

Member Avatar for vegaseat
0
130
Member Avatar for chavanak

You can create a list of lists this way ... [code]# assume that raw data is read/obtained as a string data_str = """\ d.complex.1 24 25 67 123 764 d.complex.2 23 54 35 64 d.complex.3 1 2 3 """ data_list = [] # split at the 'd' char, later put …

Member Avatar for vegaseat
0
93
Member Avatar for Fridericus

Without some pertinent code it will be impossible to help you. Which program/server event triggers the message box to appear?

Member Avatar for Fridericus
0
388
Member Avatar for hondros

One way to accomplish this is shown in code snippet: [url]http://www.daniweb.com/code/snippet263775.html#post1144145[/url]

Member Avatar for hondros
0
180
Member Avatar for JustAnotherJoe

Here is one example how to do this ... [code]# a look at wxPython menu radio buttons import wx class MyFrame(wx.Frame): def __init__(self, parent, mytitle, mysize): wx.Frame.__init__(self, parent, -1, mytitle, size=mysize) #self.SetBackgroundColour("white") # set up the menu file = wx.Menu() color = wx.Menu() self.color = color help = wx.Menu() id_blue …

Member Avatar for JustAnotherJoe
0
853
Member Avatar for fallopiano

There is a nasty bug in all your approaches to frange() ... [code]# both frange functions written by Luke Endres (fallopiano) # If your going to use it, please give credit! def frange(start, end=None, step=None): 'A range function that can accept float increments' if end == None: end = start …

Member Avatar for Gribouillis
0
576
Member Avatar for vegaseat

You can use Python modules math, wave, and struct to create and save a synthetic sine wave of given frequency and duration (size) ...

1
3K
Member Avatar for Purnima12
Member Avatar for bharatk

IMHO, Tkinter GUI code is too simple to write to warrant a visual approach. It's so much easier to build yourself a few Tkinter code templates and go with that. BTW, code produced by [B]Visual Tkinter[/B] doesn't seem to follow any Python syntax guidelines.

Member Avatar for macroasm
0
398
Member Avatar for AnnetteM
Member Avatar for Gribouillis
0
3K

The End.