1,175 Posted Topics
Re: Also take a look at the turtle demo files in C:\Python34\Lib\turtledemo for instance | |
Re: If you use Windows OS, read this: http://www.cprogramming.com/tutorial/game_programming/same_game_part1.html | |
Re: 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. | |
Re: What does tu.done() do? | |
Re: 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. | |
Re: The raspberry pi sounds interesting. Could you tell us a little bit more about your personal experience with the device? | |
Re: 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. | |
Re: What computer language and operating system are you using? | |
Re: What does this little test do? import csv csv_fn = 'out.csv' out_csv = csv.writer(open(csv_fn, 'wb')) print(out_csv) | |
Re: To keep the image from being garbage-collected within the function scope, put this line `canv2.image = bg_fon2` right after line 22 | |
Re: 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)) | |
Re: 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, … | |
Re: 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) | |
Re: 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 … | |
Re: 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) … | |
Re: 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 … | |
| |
Re: 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) | |
Re: 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 … | |
Re: 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 | |
Re: Reminds me a little bit of the algorithm that appears in the Python manual for the decimal module. Check the recipes. | |
Re: 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 … | |
Re: 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, … | |
Re: 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. | |
Re: 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') … | |
Re: 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() | |
Re: Check: http://forums.devshed.com/python-programming-11/rotating-sprite-pygame-965435.html | |
Re: 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. | |
Draw a group of shapes on the Tkinter GUI toolkit canvas and animate the group using the common tag names. | |
Re: 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. | |
Re: You can try: pre = "21:20:01 T:5796 NOTICE:" for item in programList: print("{} {}".format(pre, item)) | |
Re: 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 … | |
Re: 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 … | |
Re: I like those small cubicles, you can decorate them to your likes. | |
Re: This should give you a hint: https://www.daniweb.com/software-development/python/threads/191210/python-gui-programming/12#post2131887 | |
![]() | Re: My 1997 Dodge Ram pickup truck still runs pretty well, but the rust is getting to it. |
Re: Maybe the improvement with Windows10 will be in security. | |
Re: Works well, wonder why you need function translate()? | |
Re: Help is here: http://web.chem.ucsb.edu/~kalju/MonteCarlo_3.html | |
Re: 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] … | |
Re: **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. | |
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 … | |
Re: 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, … | |
Re: 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 = … | |
Re: Python is case sensitive, so try: ser = serial.Serial("COM5", 9600) |
The End.