1,175 Posted Topics
Re: Lardmeister suggested something much simpler, something like this: [code]# using the Tkinter canvas to # draw a line from coordinates x1,y1 to x2,y2 # create_line(x1, y1, x2, y2, width=1, fill="black") try: # Python2 import Tkinter as tk except ImportError: # Python3 import tkinter as tk root = tk.Tk() root.title("drawing lines") … | |
Re: The function split() is for strings, not for lists. In your program build up a CSV string rather than a list. Something like this: [code]def main(): info = "" name1 = raw_input("What is your name? ") info += name1 + ',' org_name = raw_input("What organization do you work for? ") … | |
Re: [QUOTE=Ancient Dragon;502277]Obama is the smoothest talker of the bunch. Hillarity Klinton wants to cut all the senior citizen's social security and medicare benefits, freeze all raises for the next 4 years, and cut all military pay and benefits. She has already written/sponsored a bill to do exactly that. That's terrible.[/QUOTE]Why … | |
Re: My back still acts up now and then 10 years after my car accident. Hope Dani came out better! | |
I have a text I want to search for all it's upper case letters, then present these letters unique and sorted. I welcome any suggestions. | |
![]() | Re: To represent a floating point number in a formatted form for print, you have to store the result as a string in your list: [code=python]# representing print formatted floats in a list list_floats = [1/3.0, 1/6.0, 3.124567, 5.01] print list_floats """ my output (note the typical float representation problem) --> … |
Re: The Python world is going through a transition. I do more and more work with Python 3.1.2, but still use Python 2.6.5 for some stuff. Most folks are waiting for wxPython and PIL to make the transition. In the mean time I am using the PyQT GUI toolkit and the … | |
Re: Here is a basic example of the use of Sqlite3 [code]# test the sqlite3 module, write and read a database file # note that Python25 and higher versions have sqlite3 builtin # sqlite3.connect(database, timeout=5.0, isolation_level=None, # detect_types=0, factory=100) # timeout=5.0 --> allows multiple access for 5 seconds (for servers) # … | |
Re: [QUOTE=sudhakar s;879540]use mouseover or mousefocus at X,Y[/QUOTE]We are talking about the Tkinter GUI toolkit. There are no such methods. widget.focus() puts the cursor to a widget module turtle (uses tkinter) has a method goto(x,y) | |
Re: There is an old Python to C conversion program (2001): [url]http://sourceforge.net/projects/py2cmod/[/url] Another program is this Python to C++ converter (2007): [url]http://sourceforge.net/projects/shedskin/[/url] Also a Python for Delphi program exsist (2007): [url]http://mmm-experts.com/Products.aspx?ProductId=3[/url] These are the folks that wrote the PyScripter IDE. | |
Re: Looks like an applied Bible study. | |
Re: [B][COLOR="Green"]vmanes[/COLOR][/B] Like his atavar suggests is a grandfatherly well meaning figure, always helpful and friendly. He helps folks a lot in the difficult C++ forum. I mainly know him from the lounge, but always enjoy his insights into life as it is! | |
Re: Manchester United all the way! I just love Anderson! | |
Re: I don't see the C! BTW, not everybody knows this yet ~~~ gets(text); Very, very bad idea. | |
Re: Some coins are worth more in the metal used then they have purchase power. For instance the US 1 cent coin (made from zinc and copper). | |
Re: I have to create a new password every month, so it is the name of my first girl friend plus the number of the month. | |
Re: It will make future wars so much easier! Send in your robots, make a mess out of that country and leave. Any politicians dream! The only defense against such an attack is to have nuclear weapons and a good delivery system, retaliatory weapons produced and stored in secretive deep underground … | |
Re: [B]for i in range(number of blocks of 512 bits):[/B] looks like pseudo code. | |
Re: If it's a bug with Windows 7, maybe you have to wait until they release Windows 7.1 | |
Re: One way to do this is using a shifted alphabet, here is a simple example: [code]# rotation_crypt1.py # use the index in the regular alphabet and apply it to a # shifted alphabet (all upper case letters for simplicity) import string alpha = string.ascii_uppercase shift = 3 # shift the … | |
Re: I think Excel uses vbasic as an internal scripting language. It might be simpler to apply that. However, the Open Office equivalent spreadsheet can use Python as a scripting language. See module pyuno. | |
Re: Symbian is an operating system designed for mobile devices and smart-phones, | |
Re: [QUOTE=vaultdweller123;1108330]Is't really true that december 21, 2012 is the end of the world? they say the signs are clear. changing climate, frequent disaster. There is even a rumor that the government has found a new planet that can support life that rich people specially the government officials secretly built spaceships … | |
Re: I like to use tkinter for some real quick stuff, but use mostly wxPython and sometimes Pyqt. Good Pyqt examples are hard to find. My biggest source of good Pyqt info is: [url]http://www.riverbankcomputing.co.uk/static/Docs/PyQt4/html/classes.html[/url] | |
Re: Actually quite simple using button["text"]: [code]# explore Tkinter button as simple toggle import Tkinter as tk # for Python3 use import tkinter as tk def toggle_text(): """toggle button text between Hi and Goodbye""" if button["text"] == "Hi": # switch to Goodbye button["text"] = "Goodbye" else: # reset to Hi button["text"] … | |
Re: [QUOTE=askvaj;1109905]We have established client-server connection in python using send() and recv() . Now we need to send a shell command(eg: ls) from 1st system to 2nd; execute it in 2nd and copy back the result to the 1st. You people out there, please suggest something...[/QUOTE]Hijacking an old thrtead is not … | |
Re: It pays to study up on Python OOP a little. Here is an example: [code]# explore wxPython's entry/wx.TextCtrl and label/wx.StaticText import wx class MyFrame(wx.Frame): def __init__(self, parent=None): wx.Frame.__init__(self, parent, -1, size=(300, 200)) s = "Enter your name below:" label = wx.StaticText(self, -1, s) # style=wx.TE_PROCESS_ENTER needed for Linux self.text_in = … | |
Re: You need to add a space between words: [code]def small(): words = 'hello, this is my test' forbidden = 'l, h, e' a = '' for word in words.split(): for letter in word: if letter in forbidden: letter = '' else: a = a + letter # add a space … | |
Re: [QUOTE=cwarn23;1091755]Is this thread about the Unix timestamp 2038 bug when 32-bit integers run out of numbers. If they used the php bcmath library for the timestamp then they could have infinite numbers. Imagine the possibilities if they made a type of integer which could hold infinite numbers. That would be … | |
How would you make a simple bar graph from a list of data? [code]data = [20, 15, 10, 7, 5, 4, 3, 2, 1, 1, 0] [/code] | |
| |
Which Computer Language would you like to know more about, or even start to learn? | |
Re: If you want the window to stay open and allow for a graceful exit procedure, you need to set up a simple event loop at the end of the program: [code=python] # a simple pygame example # creates a white circle on a black background # the event loop makes … | |
Re: You might have to preprocess the file first. | |
Re: Green letters on a black background are really hard to read. | |
Re: You are close: [code]import string def punc(s): txt = open(s, 'r').read() print(txt) # for test only for punct in string.punctuation: if punct in txt: # update txt txt = txt.replace(punct, "") return txt # test your potential function.py module if __name__ == '__main__': # pick a text file you have … | |
Re: Looks like you need to study up on dictionaries first! [B]dictionary[key] --> value[/B] | |
![]() | Re: [QUOTE=yoni0505;1091768]You got me wrong, its not about the decoding, its about sending a form. it seems that the doesn't send the "user" and "pass". my question is how do I fix this problem? I found the solution, I had to send it to "http://yoni-examples.freehostia.com/scam/form.php"[/QUOTE]How could it have worked with the … |
Re: As long as I can still download a chicken [B]breast[/B] recipe. If it's done by the government it is bound to be stupid! | |
Re: I buy my groceries at Wal-Mart and avoid any food item made in China. | |
Re: I looked over your code and made the following observations: To expand your widgets with the frame you need to use a sizer and not absolute positioning. You sql command string might have errors due to: 1) choices in the combobox needs to be a list of valid choices for … | |
Re: The module numpy is your friend here: [code]# create matrix with arange().reshape() # perform add and multiply matrix operations # module numpy (numeric python extensions, high speed) # free from: http://sourceforge.net/projects/numpy import numpy as np # create 2 matrices using # arange([start,] stop[, step,], dtype=None) and # reshape((row, col)) use … | |
Re: I think badboy00z is correct. You can use module itertools to show it: [code]# combinations and permutations using Python3 itertools import itertools iterable = [1, 2, 3] # sample_size < len(iterable) sample_size = 2 combi_list = list(itertools.combinations(iterable, sample_size)) print(combi_list) print( '-'*50 ) sample_size = 2 combi_list2 = \ list(itertools.combinations_with_replacement(iterable, sample_size)) … | |
Re: [QUOTE=curiouskitten;813921]I need to convert a number (in decimal form) that is between 1 to 4999 to Roman Numeral Form. However, though the code I have is kinda working, its only outputting the thousand digit, not anything less or any part thats less. [code] def int2roman(number): numerals={1:"I", 4:"IV", 5:"V", 9: "IX", … |
The End.