1,175 Posted Topics

Member Avatar for GrimJack
Member Avatar for stabzagg

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") …

Member Avatar for morgadao
0
5K
Member Avatar for azrael_

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? ") …

Member Avatar for TrustyTony
0
216
Member Avatar for Dave Sinkula

[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 …

Member Avatar for jephthah
0
6K
Member Avatar for Tekmaven

My back still acts up now and then 10 years after my car accident. Hope Dani came out better!

Member Avatar for sneekula
0
415
Member Avatar for sneekula

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.

Member Avatar for twekberg
0
325
Member Avatar for leegeorg07

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) --> …

Member Avatar for vegaseat
0
491
Member Avatar for jcao219

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 …

Member Avatar for hondros
0
208
Member Avatar for biomed

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) # …

Member Avatar for sneekula
0
138
Member Avatar for deckchairboy
Member Avatar for aot

[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)

Member Avatar for Gribouillis
0
4K
Member Avatar for johnnybgoode

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.

Member Avatar for vegaseat
0
767
Member Avatar for lrh9
Member Avatar for Narue

[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!

Member Avatar for jonsca
2
514
Member Avatar for ITKnight
Member Avatar for subcom

I don't see the C! BTW, not everybody knows this yet ~~~ gets(text); Very, very bad idea.

Member Avatar for logiccool
0
3K
Member Avatar for chankya

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).

Member Avatar for GrimJack
0
245
Member Avatar for Salem

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.

Member Avatar for PedroStephano
0
707
Member Avatar for Salem

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 …

Member Avatar for vegaseat
1
179
Member Avatar for calccrypto

[B]for i in range(number of blocks of 512 bits):[/B] looks like pseudo code.

Member Avatar for calccrypto
0
194
Member Avatar for lllllIllIlllI

If it's a bug with Windows 7, maybe you have to wait until they release Windows 7.1

Member Avatar for sneekula
0
95
Member Avatar for SwisherStreets

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 …

Member Avatar for Gribouillis
0
127
Member Avatar for dinilkarun

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.

Member Avatar for sneekula
0
111
Member Avatar for sindhujavenkat
Member Avatar for sneekula
0
70
Member Avatar for vaultdweller123

[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 …

Member Avatar for ankush.mukherje
0
158
Member Avatar for cascade3891

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]

Member Avatar for vegaseat
1
526
Member Avatar for thehivetyrant

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"] …

Member Avatar for thehivetyrant
0
12K
Member Avatar for Avner .H.

[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 …

Member Avatar for sneekula
0
860
Member Avatar for cascade3891

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 = …

Member Avatar for Stefano Mtangoo
0
436
Member Avatar for vlady

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 …

Member Avatar for sneekula
0
124
Member Avatar for Ancient Dragon

[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 …

Member Avatar for jbennet
0
134
Member Avatar for sneekula

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]

Member Avatar for Stefano Mtangoo
0
562
Member Avatar for happygeek
Member Avatar for mitch9654
0
317
Member Avatar for sneekula
Member Avatar for gelgin2k
3
593
Member Avatar for cwarn23
Member Avatar for senateboy

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 …

Member Avatar for vegaseat
0
9K
Member Avatar for RogerI
Member Avatar for vlady
Member Avatar for SoulMazer
Member Avatar for Stefano Mtangoo
0
120
Member Avatar for zrin

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 …

Member Avatar for zrin
0
100
Member Avatar for letlet_pogs
Member Avatar for lewashby

Looks like you need to study up on dictionaries first! [B]dictionary[key] --> value[/B]

Member Avatar for sneekula
0
106
Member Avatar for yoni0505

[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 …

Member Avatar for sneekula
0
228
Member Avatar for lewashby
Member Avatar for cwarn23

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!

Member Avatar for vegaseat
0
192
Member Avatar for Ancient Dragon

I buy my groceries at Wal-Mart and avoid any food item made in China.

Member Avatar for hotmatrixx
2
126
Member Avatar for hdk

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 …

Member Avatar for Stefano Mtangoo
0
350
Member Avatar for punter999

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 …

Member Avatar for vegaseat
0
149
Member Avatar for badboy00z

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)) …

Member Avatar for badboy00z
0
859
Member Avatar for curiouskitten

[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", …

Member Avatar for vernondcole
0
4K

The End.