Search Results

Showing results 1 to 40 of 80
Search took 0.02 seconds.
Search: Posts Made By: Ene Uran
Forum: Python 17 Days Ago
Replies: 3
Views: 152
Posted By Ene Uran
There is some important information missing here. What module are you using/importing?

Also I have a dislike for people who post two threads on the same subject. That is very rude. Which one of...
Forum: Geeks' Lounge 26 Days Ago
Replies: 9
Views: 465
Posted By Ene Uran
Forum: Python Sep 29th, 2009
Replies: 22
Views: 1,006
Posted By Ene Uran
This problem has been around for a long time and not just with Python:
# the "Microsoft kludge", quoting a string within a string fixes the
# space-in-folder-name problem, tells the OS to use the...
Forum: Python Sep 27th, 2009
Replies: 20
Solved: Text Files
Views: 600
Posted By Ene Uran
See if something like this will do, but be careful that all the slicing doesn't steal some data:
def extract_number(data_str):
"""
extract the numeric value from a string
(the string...
Forum: Python Sep 26th, 2009
Replies: 80
Views: 18,137
Posted By Ene Uran
There is another Python version called IronPython that uses Python syntax. It runs independent from the normal CPython version and allows access to the large GUI libraries of .NET and Mono. Here is...
Forum: Python Sep 7th, 2009
Replies: 80
Views: 18,137
Posted By Ene Uran
A similar table, this time we use PyQT's QTableView and QAbstractTableModel which allows the items in the table to be sorted by simply clicking on the header titles:
# use PyQT's QTableView and...
Forum: Python Sep 7th, 2009
Replies: 80
Views: 18,137
Posted By Ene Uran
Thanks vegaseat for the newer PyQT style info. Here is a relatively simple way to display tabular data using a function to create an html coded table:
# PyQT's QLabel widget can display html...
Forum: Python Sep 5th, 2009
Replies: 2
Views: 335
Posted By Ene Uran
Look over this code sample, it should be very explanatory:
# role of self in Python classes
# self can be named different, but 'self' is convention

class Snake:
def __init__(self, name):
...
Forum: Python Sep 3rd, 2009
Replies: 2
Views: 251
Posted By Ene Uran
Take a look at:
http://sourceforge.net/projects/pyexcelerator/

Here is example code:
http://sujitpal.blogspot.com/2007/02/python-script-to-convert-csv-files-to.html
Forum: Python Sep 3rd, 2009
Replies: 80
Views: 18,137
Posted By Ene Uran
A quick look at Tkinter's radio and check buttons:
# exploring multiple Tkinter radio buttons
# radio buttons only allow one item to be selected/checked
# ene

try:
# Python2
import...
Forum: Python Aug 27th, 2009
Replies: 80
Views: 18,137
Posted By Ene Uran
An enlightening look at Tkinter's grid layout manager:
# looking at the Tkinter grid() layout manager
#
# The size of a grid cell in a given row or column is
# determined by its largest widget....
Forum: Geeks' Lounge Jul 12th, 2009
Replies: 83
Views: 4,232
Posted By Ene Uran
On a notebook that you take from class to class, Windows Vista is simply unacceptable since it takes at least five minutes to boot up and just about the same to shut down. I hope Windows 7 offers...
Forum: Python Jul 8th, 2009
Replies: 4
Views: 297
Posted By Ene Uran
Simply use list():
list1 = ['a', 'b', 'c', 'd']
# this will create a new list with a different mem ref
temp_list1 = list(list1)
for i in range(len(list1)):
temp_list1[i] = "1"
print list1; ...
Forum: Python Jul 7th, 2009
Replies: 6
Views: 384
Posted By Ene Uran
You mean something like this:
# data string read from a file
data = """\
gnl|dbSNP|rs13484118 gi|62750812|ref|NC_005111.2|NC_005111 95 20 1 0 68 87 31017559 31017578 4.4 32.3
gnl|dbSNP|rs13484118...
Forum: Geeks' Lounge Jul 7th, 2009
Replies: 5
Views: 442
Posted By Ene Uran
Let's see if the Omron Smile Scan system works on holders of State of California short term debts and bonds. California has started pay off with I.O.U.'s rather than actual money.
Forum: Geeks' Lounge Jul 6th, 2009
Replies: 68
Views: 5,018
Posted By Ene Uran
Why did we get into such a mess?
Instant food
Instant credit
Instant war
Instant debt

.. just to mention four reasons.
Forum: Geeks' Lounge Jul 6th, 2009
Replies: 61
Views: 4,123
Posted By Ene Uran
The last update of MS IE did me in, after it fooled around with my 'favorite folders'. I am now a very happy Firefox user.
Forum: Geeks' Lounge Jul 6th, 2009
Replies: 41
Views: 3,902
Posted By Ene Uran
The debt per person in the USA is cheap compared to other countries. Let's celebrate with Chinese fireworks! I love the stench of burning sulfur from the fireworks, much better than the normal LA...
Forum: Python Jul 6th, 2009
Replies: 1
Views: 801
Posted By Ene Uran
In Python it would look like:
fout = open("test1.txt", "w")
fout.write("save something ...\n")
fout.write("save something more ...\n")
fout.close()

# or C++ style (allowed in Python2)
fout =...
Forum: Python Jul 5th, 2009
Replies: 80
Views: 18,137
Posted By Ene Uran
Here is a general notebook widget class for Tkinter:
# testing a notebook widget class for Tkinter (modified)
# Python 2.5.4 ene

import Tkinter as tk

class Notebook(object):
"""
a...
Forum: Python Jun 17th, 2009
Replies: 80
Views: 18,137
Posted By Ene Uran
PyQT has an interesting widget called a dial (circular slider). Here is a simple applcation:
# use a PyQT QDial knob to select a temperature
# show Celsius and corresponding Fahrenheit values
#...
Forum: Python Jun 13th, 2009
Replies: 80
Views: 18,137
Posted By Ene Uran
Draw a simple bar chart with PyQT:
# use PyQT to draw a simple vertical bar chart
# tested with PyQT4.5 and Python3.0
# ene

import sys
# simplified import, hopefully no namespace conflicts...
Forum: Python Jun 13th, 2009
Replies: 130
Views: 50,349
Posted By Ene Uran
I think we may have talked about this before, but I can't find it. Here is a way to use a sound file inside the Python code and play it. First create a base64 encoded string of the binary sound...
Forum: Geeks' Lounge May 24th, 2009
Replies: 6
Solved: Cycle path?
Views: 617
Posted By Ene Uran
Did you have a bad day?
Forum: Python May 24th, 2009
Replies: 80
Views: 18,137
Posted By Ene Uran
Tkinter has some nice pop-up dialogs that can also be used for regular console programs. Here is an example to use if you want to get a filename from a pop-up window. It works with Python2x or...
Forum: Python May 19th, 2009
Replies: 9
Views: 572
Posted By Ene Uran
Here is an example without a titlebar and showing fullscreen:
# wx.Frame with no title bar and showing fullscreen
# modified from vegaseat's example

import wx

def exit(event):
...
Forum: Python May 13th, 2009
Replies: 80
Views: 18,137
Posted By Ene Uran
A small Python/PyQT4 utility program to find out what kind of fonts your computer has:
# bring up a font dialog with PyQT4
# show the selected font using a sample text

import sys
# hopefully no...
Forum: Python May 12th, 2009
Replies: 80
Views: 18,137
Posted By Ene Uran
An example how to use the QPainter to create a wallpaper background:
# a simple window using PyQT
# using a canvas with a texture/wallpaper background

import sys
# pray for minimal namespace...
Forum: Python May 12th, 2009
Replies: 80
Views: 18,137
Posted By Ene Uran
I got PyQT4 istalled and working on my Vista computer. Here is an example of my first program:
# display a bunch of random circles using PyQT4

import random
import sys
# pray for minimal...
Forum: Python Feb 16th, 2009
Replies: 2
Views: 1,016
Posted By Ene Uran
Expanding on jrcagle post:
import shutil

source_file = r"C:\Python25\Atest\Bull\shutil_test.txt"
destination = r"C:\Python25\Atest\Bull\Test"

# this copies the source file to the destination...
Forum: Python Feb 13th, 2009
Replies: 5
Views: 637
Posted By Ene Uran
Oh yes, Python has an array type, but you must import module array:
# module array has Python's array type

import array

# Python25 use 'c' as the character typecode
# Python30 uses unicode...
Forum: Geeks' Lounge Feb 11th, 2009
Replies: 1,560
Views: 209,269
Posted By Ene Uran
"A person should not be too stupid. Stupid people are screwed first. "
Forum: Python Feb 5th, 2009
Replies: 2
Views: 268
Posted By Ene Uran
Two loops will do, or you can use a list comprehension:
rank = ("A", "2", "3", "4", "5", "6", "7", "8", "9", "10", "J", "Q", "K")
suit = ("c", "h", "s", "d")

card = []
for r in rank:
for s...
Forum: Geeks' Lounge Feb 2nd, 2009
Replies: 80
Views: 8,565
Posted By Ene Uran
Man "I’d like to call you. What’s your number?"
Woman "It’s in the phone book."
Man "But I don’t know your name."
Woman "That’s in the phone book too."
Forum: Python Jan 26th, 2009
Replies: 8
Views: 3,191
Posted By Ene Uran
For the time being you will have to use good old Tkinter that ships with Python3.0.
Forum: Python Jan 24th, 2009
Replies: 2
Views: 758
Posted By Ene Uran
You simply append the directory to PYTHONPATH before you import your custom module:
import sys
# appends to PYTHONPATH the location of the example codes
sys.path.append(r'C:\Python25\Examples')
Forum: Geeks' Lounge Dec 31st, 2008
Replies: 151
Views: 14,231
Posted By Ene Uran
Accidents happen (explains why I didn't get a Xmas present):
Forum: Geeks' Lounge Nov 29th, 2008
Replies: 151
Views: 14,231
Posted By Ene Uran
Resolving to surprise her husband, an executive's wife stopped by his office. When she opened the door, she found him with his secretary sitting in his lap.

Without hesitating, he dictated,...
Forum: Python Oct 21st, 2008
Replies: 8
Views: 774
Posted By Ene Uran
Here is a general example you can adopt, let us know if it works for your case:
# using module subprocess to pass arguments to and from an
# external program

import subprocess

# put in the...
Forum: Python Sep 26th, 2008
Replies: 10
Views: 1,630
Posted By Ene Uran
Why do all the extra work, if Python can do it for you?
result3=[
83,97,109,117,101,108,32,83,109,105,116,104,13,10,13,10,84,
104,97,110,107,32,121,111,117,32,102,111,114,32,108,111,111,...
Showing results 1 to 40 of 80

 


About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC