4,305 Posted Topics

Member Avatar for Fernando_1
Member Avatar for LostStranger

Here is my limited info ... # using the module ctypes you can access DLLs written in C/C++ # ctypes converts between Python types and C types # there are two ways to write DLLs: # most common uses cdecl, import with cdll # Win and VB may use stdcall, …

Member Avatar for vegaseat
0
467
Member Avatar for azareth
Member Avatar for <M/>
0
245
Member Avatar for HoneyBadger
Member Avatar for vegaseat
0
337
Member Avatar for krystosan

You can test it with id() ... mylist = [1,3,5] newlist = mylist print id(mylist), id(newlist) mylist = [2,4,6] print id(mylist), id(newlist)

Member Avatar for Lardmeister
0
210
Member Avatar for in_xx

You could try wxPython's excellent tabbed notebook widget ... ''' pwx_Notebook_simple1.py experiments with wxPython's wx.Notebook() widget wx.Notebook(parent, id, pos, size, style, name) tab position style=wx.NB_TOP is default others are wx.NB_BOTTOM, wx.NB_LEFT or wx.NB_RIGHT tested with Python273 and wxPython291 For Python32 downloaded the most recent wxPython-Phoenix-r73709-win32-py3.2.tar.gz from http://wxpython.org/Phoenix/snapshot-builds/ then simply extracted …

Member Avatar for vegaseat
0
481
Member Avatar for kasi123
Member Avatar for tony75

This seems to work ... message = 'your mother wears army socks' shift = 1 def cipher(message, shift): result = '' for letter in message: x = ord(letter) if letter.isalpha(): x = x + shift offset = 65 if letter.islower(): offset = 97 while x < offset: x += 26 …

Member Avatar for tony75
0
443
Member Avatar for entropic3105
Member Avatar for vegaseat
0
303
Member Avatar for ScarWars9
Member Avatar for dirtydit27

Just a few more hints ... s = "abcdefg" for x in range(1, len(s)+1): print(s[-x:]) print(list(s[-x:]))

Member Avatar for Lucaci Andrew
0
297
Member Avatar for Plonkaa

You can use the Python Image Library (PIL) to resize your image to fit into your display widget. See: http://www.daniweb.com/software-development/python/code/450373/resize-an-image-from-the-web-pil-tkinter#

Member Avatar for vegaseat
0
320
Member Avatar for vegaseat

So you want to find out which day of the week you were born. Well at least some of us do. I actually wrote this program because my whole family was born on Sundays, and my friends didn't believe it! An oldie but goodie, moved from DeSmet C to Turbo …

Member Avatar for jnawrocki
3
1K
Member Avatar for nytman

@nytman, as a beginner you could also use a list of tuples ... # index constants for (name, salary, mark) tuple NAME = 0 SALARY = 1 MARK = 2 # create a list of (name, salary, mark) tuples mylist = [] while True: name = raw_input("Enter your name (q …

Member Avatar for nytman
0
1K
Member Avatar for ytq_

I used an oldfashioned loop to make it more clear ... mylist = [('Meat', 'Milk'), ('Cake - Cookie',), ('Apple', 'Orange')] newlist = [] for item in mylist: print(item) if '-' in item[0]: item = tuple(item[0].split(' - ')) print(item) newlist.append(item) print(newlist) ''' result ... ('Meat', 'Milk') ('Cake - Cookie',) ('Cake', 'Cookie') …

Member Avatar for Lucaci Andrew
0
9K
Member Avatar for rsewak
Member Avatar for tony75

The problem is your data lines don't split nicely into identity, name, category, price fields.

Member Avatar for tony75
0
345
Member Avatar for ritzz

s = '''"No, thanks, Mom," I said, "I don't know how long it will take."''' print(s)

Member Avatar for vegaseat
0
190
Member Avatar for welshly_2010

When you use grid() the width of the grid column is determined by the largest widget width in it. Dito for height.

Member Avatar for vegaseat
0
7K
Member Avatar for usongo123

Sneekula's answer should pretty well solve your problem. Are you sure you have read it? Opal, Ruby and Moonstone appear once and Diamond appears 3 times.

Member Avatar for vegaseat
0
184
Member Avatar for bdheeraj
Member Avatar for dalaharp

Is this like something you are thinking about? [php] // time the bubblesort of an array of random integers #include <windows.h> // GetTickCount() #include <stdio.h> // printf(), getchar() #include <stdlib.h> // srand(), rand() #define NUM_ITEMS 10000 void bubbleSort(int numbers[], int array_size); int numbers[NUM_ITEMS]; int main() { int k; long te, …

Member Avatar for rustysynate
0
3K
Member Avatar for <M/>

I wish I would have traveled near the speed of light and aged slower.

Member Avatar for <M/>
0
431
Member Avatar for vegaseat

This short piece of code shows you how to display text in color in a C# windows console program. The corresponding WIN32 API functions are in the kernel32.dll and are imported and declared external. The only other problem is to assign variable types that accommodate the types listed in the …

Member Avatar for KrayZVIII
0
1K
Member Avatar for clouds_n_things

Your code has a handful of mistakes and misconceptions. I corrected some of them to get this to work ... class Account: '''Wells Fargo.''' #global balance def __init__(self, name, pin_number, balance): self.name = name self.pin_number = pin_number self.balance = balance def alter_pin(self, enter_a_pin): '''needs work''' '''To be used a later …

Member Avatar for clouds_n_things
0
177
Member Avatar for dude1

Looks like our friend otengkwaku is on the right track. You have to rebuild a new ID string. The only problem with his code are names like "Matt Mummert"

Member Avatar for Lucaci Andrew
0
297
Member Avatar for welshly_2010

Had to test this ... try: # for Python2 import Tkinter as tk import tkFileDialog as tkfd except ImportError: # for Python3 import tkinter as tk import tkinter.filedialog as tkfd def list_dir(): dirname = tkfd.askdirectory(parent=root, initialdir="/", title='Please select a folder/directory') root.title(dirname) # test only myvar.set('Current Folder Selected is: ' + …

Member Avatar for vegaseat
0
169
Member Avatar for krystosan
Member Avatar for vegaseat

A permutation is the arrangement of a set of items in different order. One interesting application is the rearrangement of characters in a word to create other words. If all the n characters are unique, you should get n! unique permutations. You can make a list of words unique by …

Member Avatar for vegaseat
1
6K
Member Avatar for vegaseat

Scientists and deficit spenders like to use Python because it can handle very large numbers. I decided to give it a test with factorials. Factorials reach astronomical levels rather quickly. In case you can't quite remember, the factorial of 12 is !12 = 1*2*3*4*5*6*7*8*9*10*11*12 = 479001600, that is 479 million …

Member Avatar for sneekula
2
5K
Member Avatar for diafol
Member Avatar for ChrisHunter
0
265
Member Avatar for hitman007

About 6 hours during the week and 2 hours on the weekend. I don't watch much TV, but spend time outside.

Member Avatar for Chickzer
0
249
Member Avatar for syfr

I as far as I understand, the **Raspberry Pi** is a tiny inexpensive ($35) computer board based on Linux and Python. It came out about a year ago in the UK and sold over one million units so far. Correct me if I am wrong. Sounds like an interesting project …

Member Avatar for Gribouillis
0
960
Member Avatar for aVar++
Member Avatar for Ancient Dragon
Member Avatar for StefanRafa0
Member Avatar for aVar++
Member Avatar for Ene Uran
0
289
Member Avatar for robert99x

Can you mix 32 bit Python and 64 bit Excel? Give it a try. If you are using a third party module to interface with Excel, make sure its available in 64 bit format. I am thinking of xlrd or xlwt which are still 32 bits.

Member Avatar for vegaseat
0
313
Member Avatar for superbhimanshu

It might be because you are mixing layout managers place() and pack(). Never a good idea.

Member Avatar for vegaseat
0
430
Member Avatar for vegaseat

This snippet allows you to find the number of ordered permutations of items taken from a population of known size. It uses the well know algorithm with factorials. For very large populations you may want to use an approximation of factorials.

3
3K
Member Avatar for vegaseat

If you want to know the number of combinations of x things taken n at a time, you can use the Python module gmpy. The module gmpy is a C-coded Python extension module that supports fast multiple-precision arithmetic, very handy if x things reach a large number.

3
474
Member Avatar for krystosan

Here is an example ... ''' class_private101.py class variables and methods can be made private to the class ''' class C(object): ''' inheriting object is automatic in Python3 ''' # k is public to all instances of class C k = 1234 # variable names with double underline prefix like …

Member Avatar for vegaseat
0
482
Member Avatar for flebber

In other words, game in your code is just one combination. To get a list of all combinations you have to append to an empty list (as shown by Lucaci Andrew) or use the list(combinations()) approach (shown by Griboullis) ... from itertools import combinations numbers = [1,2,3,4,5,6,7,8,9,10] games = [] …

Member Avatar for vegaseat
0
433
Member Avatar for scubastevie

Just another way ... with open('numbers.txt') as f: raw_list = f.readlines() print raw_list mylist = [eval(item) for item in raw_list] print mylist ''' ['1\n', '2\n', '3\n', '4\n', '5\n', '6\n', '7\n', '8\n', '9\n', '10\n'] [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] '''

Member Avatar for Lucaci Andrew
0
228
Member Avatar for jevgeny.abramov

The code snippet at http://www.daniweb.com/software-development/python/code/448444/control-visual-3d-object-with-tkinter-buttons shows you how to control a 3D visual object.

Member Avatar for vegaseat
0
387
Member Avatar for vegaseat

This Python snippet shows how to control a VPython visual 3D sphere with Tkinter GUI toolkit button clicks.

4
3K
Member Avatar for jeremywduncan
Member Avatar for The Dude

In the restroom at work, the Boss had placed a sign directly above the sink. It had a single word on it -- "Think!" The next day, when he went to the restroom, he looked at the sign and right below, immediately above the soap dispenser, someone had carefully lettered …

Member Avatar for Ene Uran
9
4K
Member Avatar for MasterHacker110

Python has been written to have a clear and readable syntax. Ruby allows for a lot of symbolism similar to Perl. It saves you some typing, but makes things harder to read and understand. Much of the use of Ruby can be attributed to a web development framework called Rails, …

Member Avatar for Ene Uran
0
194
Member Avatar for vegaseat

Let's imagine you are taking a lot of pictures and modify them with one of those fancy image editors. You burned the image files to a CD, and decided to purge some of the outdated files because your hard drive is getting full. This Python code allows you to set …

Member Avatar for Ene Uran
0
539

The End.