1,175 Posted Topics

Member Avatar for mrhunt
Member Avatar for ALEXANDER R
Member Avatar for EdJones
Member Avatar for vegaseat
0
6K
Member Avatar for sahil_gupta

If you use Windows OS, read this: http://www.cprogramming.com/tutorial/game_programming/same_game_part1.html

Member Avatar for sneekula
0
159
Member Avatar for mark103

You may want to add a temporay `print(self.rows, len(self.add_programs))` just before line 28 to see if self.rows exceeds length - 1 It alsmost looks like self.add_programs is an empty list at that point.

Member Avatar for mark103
0
443
Member Avatar for vegaseat
Member Avatar for Chem_1
Re: IDE

Since Python has this miserable version two-three mess right now, it would be nice to have an IDE that let's the user select the version to run. Editra that comes in the wx folder allows you to easily do that, but it does not handle input() well at al.

Member Avatar for sneekula
0
679
Member Avatar for PCSAWICK829

The raspberry pi sounds interesting. Could you tell us a little bit more about your personal experience with the device?

Member Avatar for sneekula
0
2K
Member Avatar for vegaseat

Correctly typing in a 20 character jumbled password every time you turn on your computer, or want to access an account would be a royal pain. Most accounts kick you out after three tries, an essential security feature.

Member Avatar for Gribouillis
1
436
Member Avatar for shoysmTP
Member Avatar for Stuugie
0
209
Member Avatar for 4evrmrepylrning

What does this little test do? import csv csv_fn = 'out.csv' out_csv = csv.writer(open(csv_fn, 'wb')) print(out_csv)

Member Avatar for Nisar222
0
13K
Member Avatar for ~s.o.s~
Member Avatar for qashnfhkh

To keep the image from being garbage-collected within the function scope, put this line `canv2.image = bg_fon2` right after line 22

Member Avatar for sneekula
0
139
Member Avatar for Amit_25

For example: import itertools s = "a1 a2 a3 a4 a5 a6" seq = s.split() print(seq) # test for e in itertools.permutations(seq): print(" ".join(e))

Member Avatar for sneekula
0
178
Member Avatar for EdJones

The shebang line is of course very useful when you write cross-platform code or in case of `if __name__ == "__main__":` when you write a module and a test for it. To throw in function main() is a leftover from the C days. C is looking for it to start, …

Member Avatar for sneekula
0
147
Member Avatar for matrixdevuk

According to your traceback you are using Python2.7 Why not use just constants: WHITE = (255,255,255) BLACK = (0,0,0) RED = (215,45,45) BLUE = (45,87,214) YELLOW = (230,223,48) GREEN = (45,194,64)

Member Avatar for matrixdevuk
0
353
Member Avatar for Johnny Blaz

Generally: # show prime numbers # prime numbers are only divisible by unity and themselves # (1 is not considered a prime number) for n in range(2, 100): for x in range(2, n): if n % x == 0: # found a factor #print(n, 'equals', x, '*', n/x) # optional …

Member Avatar for sneekula
0
182
Member Avatar for ram_10

One possibility: def translate(text, e_s_dict): swed = "" space = " " for word in text.split(): swed += e_s_dict[word] + space return swed # english:swedish dictionary e_s_dict = {"merry":"god", "christmas":"jul", "and":"och", "happy":"gott", "new":"nytt", "year":"ĂĄr"} # english text eng_text = "merry christmas" # translate to swedish text swed_text = translate(eng_text, e_s_dict) …

Member Avatar for snippsat
0
440
Member Avatar for ram_10

You can use a while loop (stops/breaks when n is zero): def generate_n_chars(n, ch): s = "" # start with an empty string while n: s += ch # build up the string s n -= 1 # decrement n by 1 return s # test ch = 'z' n …

Member Avatar for ram_10
0
426
Member Avatar for roxie148
Member Avatar for ram_10

Hint: mystring = "briyani" for c in mystring: print(c) # then this should give you the length length = sum(1 for c in mystring) print(length)

Member Avatar for vegaseat
0
194
Member Avatar for Reverend Jim

The British spy agency the Government Communications Headquarters (GCHQ) has used a sophistcated version of the Regin virus to infect the Belgian telecommunications company Belgacom. By targeting engineers through a faked LinkedIn page, GCHQ was able to get deep inside the Internet provider to steal data. One of Belgacom's main …

Member Avatar for vegaseat
0
458
Member Avatar for tony75

Write these two batch files and put a shortcut of each on your desk top: rem save as idle27.bat rem run the IDLE IDE with Python27 C:\Python27\pythonw.exe -u C:\Python27\Lib\idlelib\idle.pyw and rem save as idle32.bat rem run the IDLE IDE with Python32 C:\Python32\pythonw.exe -u C:\Python32\Lib\idlelib\idle.pyw

Member Avatar for tony75
0
431
Member Avatar for vegaseat

Reminds me a little bit of the algorithm that appears in the Python manual for the decimal module. Check the recipes.

Member Avatar for sneekula
0
3K
Member Avatar for MasterHacker110

Looks like you use the Gregory–Leibniz series which converges rather slowly. A much faster series is given in the Python manual under the decimal module recipes: import decimal def pi_decimal(prec): """ compute Pi to the current precision """ # increase precision for intermediate steps decimal.getcontext().prec = prec + 2 D …

Member Avatar for sneekula
0
351
Member Avatar for YorkshireSpud

C# has the best integrated/unified system. However, you will be married to Windows and the NET. Let's not forget that 90% of PCs and laptops in the world are Windows based. The best part is that it produces executable files (.exe). Python has a hotch potch of IDE's, GUI toolkits, …

Member Avatar for vegaseat
0
281
Member Avatar for MasterChat

News is often falsified on government orders, and the media seems to go along with it. That's too bad since a working democracy needs well informed, not missinformed, voters.

Member Avatar for MasterChat
1
409
Member Avatar for punna.udaykumar

Here is an example to get you started: ''' random_sentences101.py # use this template to add more data adjectives.append('') subjects.append('') verbs.append('') objects.append('') ''' import random # create lists adjectives = [] subjects = [] verbs = [] objects = [] # add data to the lists adjectives.append('A small') subjects.append(' boy') …

Member Avatar for sneekula
0
487
Member Avatar for ao_py

In other words: b1 = Button(win, Point(3, 5), 5, 2, "Door 1") b1.activate() b2 = Button(win, Point(10, 5), 5, 2, "Door 2") b2.activate() b3 = Button(win, Point(17, 5), 5, 2, "Door 3") b3.activate()

Member Avatar for sneekula
0
892
Member Avatar for James_41
Member Avatar for Alex_29

Check: http://forums.devshed.com/python-programming-11/rotating-sprite-pygame-965435.html

Member Avatar for juanpa_2510
0
4K
Member Avatar for woooee

In the Python forum you get down-votes because your solution works in version Python3 and not in the old Python2 version. What a mess that is.

Member Avatar for almostbob
0
273
Member Avatar for sneekula

Draw a group of shapes on the Tkinter GUI toolkit canvas and animate the group using the common tag names.

1
5K
Member Avatar for mcroni

From http://www.lfd.uci.edu/~gohlke/pythonlibs/#pil download the Python version appropriate installer Pillow‑2.6.1.win32‑py3.4.exe Run this installer and see if the new installation fixes your problem.

Member Avatar for Gribouillis
0
340
Member Avatar for mark103

You can try: pre = "21:20:01 T:5796 NOTICE:" for item in programList: print("{} {}".format(pre, item))

Member Avatar for Gribouillis
0
279
Member Avatar for david.nicely.393

Numeric input example (works with C or C++): // a function to clean up the input of a real number #include <stdio.h> // in/out function header #include <ctype.h> // for isdigit() #include <string.h> // for strlen() #define EOS 0 // end of string marker double real_in(void); int main() { double …

Member Avatar for sneekula
0
142
Member Avatar for david.nicely.393

You can use input() for both versions of Python: # Python2 uses raw_input() for strings # Python3 uses input() for strings # ---------------------------------------------- # add these few lines near the start of you code import sys # make string input work with Python2 or Python3 if sys.version_info[0] < 3: input …

Member Avatar for sneekula
0
136
Member Avatar for McLaren
Member Avatar for sneekula
0
276
Member Avatar for Muhammad_69

This should give you a hint: https://www.daniweb.com/software-development/python/threads/191210/python-gui-programming/12#post2131887

Member Avatar for sneekula
0
113
Member Avatar for Warrens80

My 1997 Dodge Ram pickup truck still runs pretty well, but the rust is getting to it.

Member Avatar for Slavi
1
399
Member Avatar for Reverend Jim
Member Avatar for vegaseat
Member Avatar for alexamicaa
Member Avatar for Ravi_exact

I would just temporarily convert back to a Python list: import numpy as np x = np.array([['t1',10,20],['t2',11,22],['t2',12,23], ['t3',21,32]]) print(x) # test # convert temporarily to Python list again mylist = x.tolist() mylist2 = ['100', '101'] n = 0 newlist = [] for line in mylist: if line[0] == 't2': line[1] …

Member Avatar for sneekula
0
4K
Member Avatar for Adnan S.
Member Avatar for telmo96

**No module named pk_DOMI** means that cx_Freeze can't find the mnodule, or you don't have it. BTW, if you really want help don't hijack old solved posts. Most helpful folks won't look there for your problem. Start a new thread.

Member Avatar for sneekula
0
3K
Member Avatar for sneekula

I have a tkinter program like the one below (for example) and want to create an executable file using module cx_freeze. I am using Python33 and Windows7. # Tk_circle2.py # draw a circle with given center (x,y) and radius # tkinter normally needs a specified square try: # Python2 import …

Member Avatar for vegaseat
0
2K
Member Avatar for Lardmeister

In the US, we also have Soul Food or Southern Cooking: Soul Food originated from slaves' diet. For vegetables slaves used basically plants that were in those days considered weeds like collard greens, kale, cress, mustard, and pokeweed. Their recipes used discarded meat from the plantation, such as pig’s feet, …

Member Avatar for vegaseat
1
298
Member Avatar for vegaseat

The wxPython GUI toolkit has some interesting widgets, one of them is a complete analog clock widget. Here is an example: [code=python]# looking at the wxPython analog clock widget import wx from wx.lib import analogclock as ac class MyFrame(wx.Frame): def __init__(self, parent, id, title): wx.Frame.__init__(self, parent, id, title) clock = …

Member Avatar for HiHe
2
21K
Member Avatar for entropicII
Member Avatar for woooee
0
2K

The End.