904 Posted Topics

Member Avatar for jepapel
Member Avatar for Sadun89
Member Avatar for TrustyTony

Windows adds '\n\r' combo to the input() and Python 3.2 only removed the '\n', retaining the '\r' character. This bothersome bug is fixed in Python 3.2.1

Member Avatar for bumsfeld
1
501
Member Avatar for vegaseat
Member Avatar for steven woodman

Judging from the many folks that buy organic food, composting has become rather important.

Member Avatar for Ezzaral
1
160
Member Avatar for Mike_11

Something like this should work: [code]# check for password entry, close application if not correct import wx class MyClass(wx.Frame): def __init__(self, parent=None, id=-1): wx.Frame.__init__(self, parent, id, 'Password Program', size=(300,300)) panel = wx.Panel(self) box = wx.TextEntryDialog(None, 'Please type your password:','Password') if box.ShowModal() == wx.ID_OK: answer = box.GetValue() # check password, you …

Member Avatar for richieking
0
758
Member Avatar for TrustyTony
Member Avatar for TrustyTony
3
673
Member Avatar for Kirielson
Member Avatar for hszforu

I would recommend Python 2.7 for you to learn. It does have elements of Python 3 in it as options.

Member Avatar for hszforu
0
194
Member Avatar for Salem
Member Avatar for mrnutty

Sure, God talked out of a burning bush to the writers of the Bible. They had His guidance.

Member Avatar for iamthwee
2
1K
Member Avatar for jingda

Sports car is something you drive, it doesn't drive you like most of the old US heavy clunkers did.

Member Avatar for Lardmeister
0
373
Member Avatar for jingda

Theme: Power of the Office AUSTIN, TX (Dec. 12, 1999) - Attorneys for Texas Governor George W. Bush filed suit in federal court today, seeking to prevent Santa Claus from making his list then checking it twice. The complaint seeks an immediate injunction against the beloved Christmas icon, asking the …

Member Avatar for sneekula
2
298
Member Avatar for epdmcoatings

Road Runner vs Wile E. Coyote [url]http://www.youtube.com/watch?v=hz65AOjabtM[/url]

Member Avatar for sneekula
3
334
Member Avatar for Thisisnotanid
Member Avatar for Schol-R-LEA
0
333
Member Avatar for zpzp16

Hint ... [code]str_list = ['1','2.4','-5.3','7'] # use list comprehension num_list = [float(item) for item in str_list] print(num_list) # [1.0, 2.4, -5.3, 7.0] [/code]

Member Avatar for vegaseat
-1
110
Member Avatar for JohnMG
Member Avatar for TrustyTony
0
956
Member Avatar for markfw

[code]# test PySide widgets # get widget's size from PySide.QtCore import * from PySide.QtGui import * app = QApplication([]) # ----- start your widget test code ---- label = 'x'*20 button = QPushButton(label) width = button.sizeHint().width() height = button.sizeHint().height() button.show() print("button width=%d height=%d (in pixels)" % (width, height)) # ---- …

Member Avatar for vegaseat
0
226
Member Avatar for vegaseat

This might help: [url]http://download.oracle.com/javase/tutorial/uiswing/TOC.html[/url]

Member Avatar for bumsfeld
2
494
Member Avatar for jonhylever
Member Avatar for Ene Uran
-2
359
Member Avatar for HiHe

I think woooee's approach is clearer. The extra close() may be too easy to miss.

Member Avatar for vegaseat
1
170
Member Avatar for 650U

Show us one code example you have tried. For typical class inheritance see: [url]http://www.daniweb.com/software-development/python/threads/20774/273770#post273770[/url]

Member Avatar for e-papa
0
241
Member Avatar for Tcll

[code]# the Tkinter filedialog for saving file # tkfd.asksaveasfile(**options) returns file handle to save to try: # Python2 import Tkinter as tk import tkFileDialog as tkfd except ImportError: # Python3 import tkinter as tk import tkinter.filedialog as tkfd mask = [ ("Text files","*.txt"), ("Python files","*.py *.pyw"), ("All files","*.*")] # if …

Member Avatar for Tcll
0
7K
Member Avatar for xleon

Here is a typical example that might work for you: [code]# using Tkinter's Optionmenu() as a combobox # allows one item to be selected # use trace() and globalgetvar(name) to show selected choice try: # Python2 import Tkinter as tk except ImportError: # Python3 import tkinter as tk def show_choice(name, …

Member Avatar for xleon
0
4K
Member Avatar for vmanes
Member Avatar for ThePythonNoob

You can expand on that: [code]# safe numeric input function # all() needs Python25 or higher def input_num(prompt="Enter number: "): """ prompt the user for numeric input prompt again if the input is not numeric return integer or float """ while True: # coded for Python3, Python2 uses raw_input() # …

Member Avatar for bumsfeld
0
172
Member Avatar for jworld2

Wit this: [code]import math print(math.cos((2*math.pi)/3)) # -0.5 print(0.5 + math.cos((2*math.pi)/3)) # 2.22044604925e-16 print(-0.5 + math.cos((2*math.pi)/3)) # -1.0 x = math.cos((2*math.pi)/3) print(x) # -0.5 print([x]) # [-0.4999999999999998] print([-0.5 + x]) # [-0.9999999999999998] [/code]Strange?

Member Avatar for jworld2
0
539
Member Avatar for cwarn23

A extraordinarily strong solar wind could strip the Earth's atmosphere, this way only life forms that don't use oxygen will survive.

Member Avatar for GrimJack
2
358
Member Avatar for bumsfeld

This Python snippet shows you how to take typical beginner's example of prime number function and work on improving its speed. The decorator function for timing is ideal tool to follow your progress you make. The improvements are commented and you are encouraged to make further improvements. Python is fun!

Member Avatar for TrustyTony
0
2K
Member Avatar for WASDted

I am glad that our sun is as small at it is or it would have burned out long ago! In the universe small is okay! After all, the singularity that was at the origin of the big bang was so small it couldn't be measured.

Member Avatar for JamieLynnSEO
8
492
Member Avatar for Ancient Dragon

Face it, meat resources are dwindling with the ever increasing population.

Member Avatar for bumsfeld
0
150
Member Avatar for Michael_Knight

Men are simple things. They can survive a whole weekend with only three things: beer, boxer shorts and batteries for the remote control. Courtesy of Diana Jordan

Member Avatar for happygeek
0
1K
Member Avatar for vegaseat
Member Avatar for NicAx64
Member Avatar for Momerath
0
251
Member Avatar for aldusforte

Here is one short example how this sort of thing might be done: [code]# copy files with given file extensions from source to destination # shutil.copy2() retains the last access time and modification time # use shutil.move(src, dst) to move the file import os import shutil # assume you have …

Member Avatar for aldusforte
0
392
Member Avatar for python01
Member Avatar for Hoff123
Member Avatar for Hoff123
0
5K
Member Avatar for jake1496
Member Avatar for bumsfeld

The 45th annual edition of the Super Bowl in American football will be played on Sunday February 6, 2011, at the Cowboys Stadium in Arlington, Texas. It will pit the AFC champion Pittsburgh Steelers against the NFC champion Green Bay Packers to decide the NFL champion for the 2010 season. …

Member Avatar for diafol
1
162
Member Avatar for avatrin
Member Avatar for bumsfeld
0
167
Member Avatar for Speleo
Member Avatar for suhnako

Pythia, commonly known as the Oracle of Delphi, was the priestess at the Temple of Apollo at Delphi. Her site was on the slopes of Mount Parnassus in Greece.

Member Avatar for bumsfeld
-4
41
Member Avatar for zizuno
Member Avatar for richieking
0
614
Member Avatar for AndreRet

[QUOTE=Ancient Dragon;1460721]And many new ones have cell phones pre-installed and ready to go any time day or night.[/QUOTE]Are you talking about wife or girlfriend?

Member Avatar for bumsfeld
2
192
Member Avatar for bumsfeld

Just curious how you got started. For me it was science class that used Python as the main tool.

Member Avatar for vegaseat
1
128
Member Avatar for fugmag

I don't like l as variable name (looks too much like number one), so I changed it a little: [code]import os import fnmatch for fn in os.listdir("C:/Bilder"): print fn # test if fnmatch.fnmatch(fn, 'IMG*'): fn = fn.replace(fn, "HH") print fn """my result --> IMG100_0015.jpg HH """ [/code]

Member Avatar for fugmag
0
175
Member Avatar for Mithrandir85
Member Avatar for blenkhn

Here is typical example of the PyQt QTabWidget() tested with Python27 and PyQT4.8.2 [code]# explore the PyQt QTabWidget() from PyQt4.QtCore import * from PyQt4.QtGui import * class MainWindow(QWidget): def __init__(self): QWidget.__init__(self) # setGeometry(x_pos, y_pos, width, height) self.setGeometry(250, 150, 400, 300) self.setWindowTitle("explore QTabWidget()") tab_widget = QTabWidget() tab1 = QWidget() tab2 = …

Member Avatar for bumsfeld
-1
1K
Member Avatar for sneekula

It is the Earth's magnetic field that protects its atmosphere from being blown away by solar winds. However the magnetic field has declined by 6% in the last 100 years.

Member Avatar for bumsfeld
2
935
Member Avatar for Hawkeye Python

Another way is to use the event: [code]# Tkinter, show the button that has been clicked # using the bind event import Tkinter as tk def click(event): """ event.widget.cget("text") gets the label of the button clicked """ s = "clicked: " + event.widget.cget("text") root.title(s) root = tk.Tk() root.geometry("300x50+30+30") b1 = …

Member Avatar for Hawkeye Python
0
3K

The End.