4,305 Posted Topics

Member Avatar for vegaseat
Member Avatar for Screwby

Nice approach. However, opening a potentially endless amount of windows is terribly resource demanding. I would suggest to put the mouse info into the title bar of the root window ... [code]# PlottingProgram101.py try: # Python2 import Tkinter as tk except ImportError: # Python3 import tkinter as tk class FunctionFrame(object): …

Member Avatar for Lardmeister
0
11K
Member Avatar for Stefano Mtangoo

Got it to work with Windows7, see ... http://www.daniweb.com/software-development/python/code/455571/dragable-frame-using-wxpython-phoenix Project Phoenix is still very alpha.

Member Avatar for Werner F.
0
1K
Member Avatar for psichoman5
Member Avatar for Gribouillis
0
2K
Member Avatar for rose_2

There are a large number of Python programming videos on YouTube. YouTube itself is written using Python. Example ... http://www.youtube.com/watch?v=4Mf0h3HphEA&feature=channel or ... https://www.youtube.com/watch?v=tKTZoB2Vjuk

Member Avatar for Schol-R-LEA
0
374
Member Avatar for Fo.katia

You can do it if the two points are at the ends of the diagonal. See ... http://www.mathsisfun.com/geometry/rectangle.html If you use the Tkinter GUI toolkit, the two points you need to create a rectangle are the upper left corner and lower right corner.

Member Avatar for vegaseat
0
3K
Member Avatar for OnEaglesWingsjf

Here is a general example that might help ... ''' distance_two_points.py calculate the distance between two points given the coordinates of the points (x1, y1) and (x2, y2) in a 2D system ''' import math def get_distance(x1, y1, x2, y2): ''' returns distance between two points using the pythagorean theorem …

Member Avatar for vegaseat
0
340
Member Avatar for happygeek

I have sported a mustache on and off. Usually a bad cold comes up making a mess of it, so the thing is gone for a while.

Member Avatar for DistantGalaxy
1
520
Member Avatar for Santanu Das
Member Avatar for NITHIN171

This will do it ... # tk_KeyLogger.py # show a character key when pressed try: # Python2 import Tkinter as tk except ImportError: # Python3 import tkinter as tk def key(event): """show just the character key""" if event.keysym == 'Escape': root.destroy() print(event.char) root = tk.Tk() print("Press a key (Escape key …

Member Avatar for NITHIN171
0
162
Member Avatar for saimasiddiqui

I assume your teacher wants you to use Python code to assign the first three flowers to a sublist. That's where append could be used.

Member Avatar for Gribouillis
0
1K
Member Avatar for kiddo39

You can also use the newer syntax available with Python 2.7 and Python3+ ... sentence = "I now have a total of {} yellow bananas!" for i in range(2, 11): print(sentence.format(i))

Member Avatar for kiddo39
0
274
Member Avatar for silverdust

Try this ... #!/usr/bin/env python # # @author: Joseph Rex # @website: http://josephrex.me # @repository: http://github.com/bl4ckdu5t/registron # # # import sys, webbrowser from PyQt4 import QtGui, QtCore from ui_registron import Ui_MainWindow try: import pyttsx except ImportError: raise ImportError, "pyttsx module is required for speech features of registron" class Main(QtGui.QMainWindow): """Main …

Member Avatar for silverdust
0
3K
Member Avatar for vegaseat

Similiar to the snippet posted at: http://www.daniweb.com/software-development/python/code/449036/display-an-image-from-the-web-tkinter but this time we use PIL to resize the image from the internet keeping its aspect ratio to fit a specific display area/box.

Member Avatar for HiHe
3
2K
Member Avatar for vegaseat

The Pyside GUI toolkit (public PyQt) lets you bring up an interactive web page with its QWebView widget. Here is a simple example.

2
700
Member Avatar for EDWIN_4

You use it when you don't know the exact number of arguments. Simple example ... def average3(*args): """ don't know the exact number of numeric arguments passed prefix * indicates a tuple of variable number of args """ return sum(args)/float(len(args)) print(average3(1, 2, 3, 4, 25)) # 7.0

Member Avatar for snippsat
0
150
Member Avatar for dani_boy

I would recommend the Pygame Mixer. It works well with Tkinter. In my experience modules like pySFML don't get along with Tkinter's event loop. Here is an example ... ''' tk_pg_playmusic2.py play a sound file with Tkinter using the module pygame works with .wav .ogg .mid or .mp3 sound/music files …

Member Avatar for HiHe
0
3K
Member Avatar for psichoman5

Initialize your variables A to L this way: `A = B = C = D = E = F = G = H = I = J = K = L = 0` before you reach your if statements.

Member Avatar for woooee
0
468
Member Avatar for Slavi

To expect privacy from the likes of Facebook, Twitter etc. would be silly.

Member Avatar for vegaseat
0
402
Member Avatar for mark103
Member Avatar for vegaseat
0
1K
Member Avatar for entropicII

The Python interpreter searches for module "serial" first in the working directory, then in its builtin modules in directory Lib, then in its packages. When it finds a file serial.py in the working directory it will import your code file instead of the module. So please do not name any …

Member Avatar for woooee
0
2K
Member Avatar for sneekula

Windows binaries are also still available at: http://www.lfd.uci.edu/~gohlke/pythonlibs/ Pyglet uses AVbin for sound, so you could check that: http://avbin.github.io/AVbin/Home/Home.html

Member Avatar for sneekula
0
256
Member Avatar for mcroni

You could make a list of image file extension and in a loop add these to your file name and check if the file exists. If it does exist load it. See the Python manual under module os

Member Avatar for vegaseat
0
279
Member Avatar for Jai_4

Hint ... digits = '123456' size = len(digits) # list of even indexed digits, positions 0,2,4, ... evens = [int(digits[n]) for n in range(0, size, 2)] # list of odd indexed digits odds = [int(digits[n]) for n in range(1, size, 2)] print(evens) # [1, 3, 5] print(odds) # [2, 4, …

Member Avatar for sneekula
0
802
Member Avatar for iConqueror

Sheep + People = Sheeple Sheeple, most of us, are easily programmed particularly by the news media.

Member Avatar for Reverend Jim
0
531
Member Avatar for sneekula

Wow, lots of options! I myself am more partial to slicing, unless you have to pad your resulting sequence.

Member Avatar for sneekula
0
260
Member Avatar for pratz

Most likely this should work ... [code]import mod class cls2(mod.cls1): pass [/code]

Member Avatar for Amigodornot666
0
524
Member Avatar for La

Somewhat goofy partial code. Could your problems be with the steganography processing? Did you try to put a normal image to test?

Member Avatar for vegaseat
-1
679
Member Avatar for rednose00
Member Avatar for BingityBongity

One more possibility ... from collections import Counter original_list = ["hello", "hi", "hi", "bye", "hi", "bye"] # most_common() gives a list of all (word, freq) tuples sorted by count wordcount = Counter(original_list).most_common() print(wordcount) ''' result ... [('hi', 3), ('bye', 2), ('hello', 1)] '''

Member Avatar for snippsat
0
380
Member Avatar for Reverend Jim
Member Avatar for Reverend Jim
1
392
Member Avatar for Emmanuel_2

Module graphics is a wrapper around Tkinter, so take a look at: http://infohost.nmt.edu/tcc/help/pubs/tkinter/web/create_polygon.html

Member Avatar for vegaseat
0
289
Member Avatar for diliupgabadamudalige
Member Avatar for Warrens80

My senior year in HS happened in Germany, and I had to sit in the backrow in class because I didn't look German.

Member Avatar for veedeoo
0
250
Member Avatar for vegaseat

The portable version of Python (versions 2.7 and 3.2 are available) can be run from your hard drive or a flash drive. In many ways this makes your live easier, since a lot of libraries are included already. Also, you can take your code to a friend on a flash …

Member Avatar for sneekula
2
3K
Member Avatar for mattster

A agree with <M/>, Mickey Mouse needs to be introduced as the real hero of the silly thing.

Member Avatar for mattster
0
359
Member Avatar for vegaseat

This short Python program calculates Euler's number e, the base of natural logarithms, to a precision of at least 100 digits in this case. To get the precision needed, the Python module decimal is used. The result is compared to a published result.

Member Avatar for vegaseat
3
2K
Member Avatar for rbyrd

Only responds when you click on the border of the rectangle. You have to fill the rectangle with eg. white to make the whole shape respond.

Member Avatar for vegaseat
0
362
Member Avatar for ih8bugz
Member Avatar for ddanbe

I can imagine walking through a field of flowers to get to my favorite fishing spot wearing ear plugs.

Member Avatar for Hiroshe
1
126
Member Avatar for ddanbe
Member Avatar for chophouse

You might also consider working with deque (double ended que, pronounced 'deck') from the Python module collections ... from collections import deque mylist = [1,2,3,4,5,6,7] mydeque = deque(mylist) mydeque.rotate(3) print(list(mydeque)) # [5, 6, 7, 1, 2, 3, 4]

Member Avatar for chophouse
0
298
Member Avatar for masterofpuppets

I truly frown on folks using Python Shell code for tutorials, it looks ugly, messy, confusing to beginners, and not Pythonic at all! Python prides itself on readable syntax. [B]Thanks for the update and correction![/B]

Member Avatar for Alf1#
5
1K
Member Avatar for iConqueror

Wouldn't it be nice to have the leaders in Washington/London to have an accrediated education?

Member Avatar for heidi.dum
1
481
Member Avatar for frankie198

With the Windows OS **PyScripter** (written with Delphi) is my choice. It's fast and gives a lot of helping hints when coding.

Member Avatar for Jack_9
0
854
Member Avatar for iamthwee
Member Avatar for lionaneesh

''' dict_dynamic101.py create a dictionary dynamically tested with Python27 and Python34 ''' # ---------------------------------------------- # add these few lines near the start of you code import sys # make string input work with Python2 or Python3 if sys.version_info[0] < 3: input = raw_input # ---------------------------------------------- mydict = {} while True: …

Member Avatar for vegaseat
0
668
Member Avatar for vegaseat

This simple code shows how to write text with a given font, font size and color using the module pygame ...

Member Avatar for lsallen
4
7K
Member Avatar for abaddon2031

Maybe this will help ... s = "test01-15.dat" q = s.split('.') print(q) print(q[0]) numeric = "".join(n for n in s.split('.')[0] if n in '0123456789-') print(numeric) print(numeric.split('-')) ''' result ... ['test01-15', 'dat'] test01-15 01-15 ['01', '15'] '''

Member Avatar for Gribouillis
0
478
Member Avatar for vegaseat

The End.