4,305 Posted Topics

Member Avatar for almostbob
Member Avatar for ujjwale
Member Avatar for bCubed
0
318
Member Avatar for JonKho

The two different eventloops don't work very gracefully together. There is a lot of flickering. Threading might improve performance? The only thing that works reasonably well is the pygame.mixer and Tkinter to play sounds in a Tkinter application.

Member Avatar for vegaseat
0
3K
Member Avatar for Gribouillis

This code also works with Python3 ... [code=python]# explore module ctypes to get mouse position # tested with Python 2.5.4 and Python 3.1.1 import ctypes as ct class GetPoint(ct.Structure): _fields_ = [("x", ct.c_ulong), ("y", ct.c_ulong)] def get_mousepos(): pt = GetPoint() ct.windll.user32.GetCursorPos(ct.byref(pt)) return int(pt.x), int(pt.y) print( "Mouse position at start of …

Member Avatar for woooee
1
6K
Member Avatar for supermastereu

See also ... http://www.daniweb.com/software-development/c/code/216595/read-an-integer-from-the-user-part-2

Member Avatar for Learner010
0
363
Member Avatar for Dani

A local anesthetic like the gel one uses on gums for a sore tooth might help.

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

This program takes a text string and creates a list of words. Any attached punctuation marks are removed and the words are converted to lower case for sorting. Now you can generate a dictionary of the words and their frequencies. The result is displayed using a sorted list of dictionary …

Member Avatar for snippsat
2
1K
Member Avatar for vegaseat

The Fibonacci series of numbers was used by Leonardo of Pisa, a.k.a. Fibonacci (around the year 1200), to describe the growth of a rabbit population. The series has been noted to appear in biological settings, such as the branching patterns of leaves in grasses and flowers. We take a look …

Member Avatar for Stefan_3
1
2K
Member Avatar for vegaseat

Because of their demand only nature, generators are ideal for finding the combinations of larger sequences. This code applies a Python generator to find the combinations of the sequence. Since permutations are a special case of combinations for all the items in a sequence, I have expanded the result to …

Member Avatar for Stefan_3
1
438
Member Avatar for Nima_1

A mild hint to help you along ... // FuncByRef2.c // pass function arguments by reference using pointers #include <stdio.h> void swap(int *x, int *y) { int temp = *x; *x = *y; *y = temp; } int main() { int x = 6, y = 10; printf("Before swap(), x …

Member Avatar for Daisy_1
0
248
Member Avatar for lewashby

Another way is to create a folder like MyModules in a path that Python has on its PYTHONPATH eg. C:\Python27\MyModules Now save your module eg. module1.py in there. You also have to create an `__init__.py` file (can be empty) in that folder, so that Python assumes that it's dealing with …

Member Avatar for Gribouillis
0
1K
Member Avatar for Anjolie

Your competition will be thousands of folks from foreign lands here on a work visa. http://fortune.com/2013/08/05/the-myth-of-americas-missing-software-engineers/

Member Avatar for veedeoo
0
391
Member Avatar for yuimikazuki

**in_file** is a file handle **indata** is a string containing the contents of the file

Member Avatar for David W
0
224
Member Avatar for Jack_9

Python is a high level language, really not written to do low level access needed for OS use like C. There have been past attempts ... https://github.com/tornewuff/pycorn

Member Avatar for mike_2000_17
0
264
Member Avatar for yeshamarques
Member Avatar for diafol
0
513
Member Avatar for iConqueror
Member Avatar for Reverend Jim
0
214
Member Avatar for blackmiau

In 1977 an engineering friend and I put together a MITS Altair computer. You had to use the front panel toggle switches to code in machine language. A few years later I progressed to Radio Shack's TRS-80 that used a cassette recorder for storage and you coded in BASIC. If …

Member Avatar for almostbob
4
1K
Member Avatar for BogdanCov

The right game can be very refreshing to your mind. BTW, I don't think getting old is in your control. It simply sneaks up on you!

Member Avatar for vegaseat
1
287
Member Avatar for RikTelner
Member Avatar for vegaseat
0
268
Member Avatar for Suresh_6
Member Avatar for iuessele
Member Avatar for alexander.selin.7
0
13K
Member Avatar for zina_a
Member Avatar for mattster
Member Avatar for polodas
1
680
Member Avatar for mark103

I think it is `self.getControl(4202).SetLabel(str(secondsLeft)+"%")` Here is an example ... # click on a wx.StaticText() label widget import wx class MyPanel(wx.Panel): def __init__(self, parent): wx.Panel.__init__(self, parent, wx.ID_ANY) self.label = wx.StaticText(self, wx.ID_ANY, label="Oh My GOD", pos=(10, 10)) self.label.SetBackgroundColour("yellow") # respond to the left mouse button click self.label.Bind(wx.EVT_LEFT_DOWN, self.onAction) def onAction(self, event): …

Member Avatar for vegaseat
0
419
Member Avatar for frankie198
Member Avatar for omnik123
Member Avatar for ckide

If you are moving a lot, you will hate those heavy boxes of paper books very quickly.

Member Avatar for hericles
0
377
Member Avatar for nitin1
Member Avatar for iAssistant
Member Avatar for Mya:)
Member Avatar for ZZucker

One idea, the result of glob.glob(path) is a list, so you could add the two lists `list_py_txt = glob.glob("c:/temp/*.py") + glob.glob("c:/temp/*.txt")`

Member Avatar for snippsat
0
519
Member Avatar for dw85745

I have done a lot of different languages over the years, but Python suites my feeble mind the best.

Member Avatar for Reverend Jim
0
374
Member Avatar for almostbob
Member Avatar for satroan
Member Avatar for ZZucker
0
291
Member Avatar for perlinda

This worked for me ... ''' Py2ExeConSetup.py Py2Exe (version 6.6 and higher) setup file for a console program. Creates a single .exe file. Simply add this file into the same folder with your source file (s). Change your main source filename at the bottom to whatever you called your main …

Member Avatar for perlinda
0
506
Member Avatar for danae.gordon9

A special case is the rotational shift by 13 positions (half the alphabet) ... ''' str_rot13.py rotate the letters in a string by 13 positions (half the alphabet) tested with Python2.7.6 and Python3.2.5 ''' def str_rot13(text): ''' cipher rotate text by 13 letters (half the alphabet) ''' # ascii code …

Member Avatar for vegaseat
0
262
Member Avatar for harrykokil

Here is an example using the Tkinter GUI toolkit ... # Tkinter animate via canvas.move(obj, xAmount, yAmount) import Tkinter as tk import time root = tk.Tk() canvas = tk.Canvas(root, width=400, height=400) canvas.pack() # canvas.create_rectangle(x0, y0, x1, y1, option, ... ) # x0, y0, x1, y1 are corner coordinates of ulc …

Member Avatar for TrustyTony
0
10K
Member Avatar for drayford

Inputs can be handled by the Entry() widget and bound the return key. For an example see: http://www.daniweb.com/software-development/python/code/216577/parallel-resistance-calculator-gui-python

Member Avatar for ZZucker
0
325
Member Avatar for ItsAdZy

Actually IDLE that comes with the normal Python distribution is quite good. If you use WIndows and have Python32, you can run this little batch file to get IDLE going ... REM a batch file to force IDLE to use Pyhon32 REM saved as IDLE32.bat C:\Python32\pythonw.exe -u C:\Python32\Lib\idlelib\idle.pyw There is …

Member Avatar for RogueHaxor
0
1K
Member Avatar for Rabee_1

Looks like Rabee_1 is talking about a Raspberry Pi computer that uses Python on Linux. See ... http://en.wikipedia.org/wiki/Raspberry_Pi So a Python dictionary that converts each letter to the appropriate zero and one sequence might be the solution. If I am not mistaken, the Rasberry uses a standard USB Flashcard as …

Member Avatar for iamthwee
0
481
Member Avatar for vegaseat

This AVI file player has some nice features like adjusting size and speed. The program uses the standard MSvfw32.lib (called libmsvfw32.a in the DevCPP lib directory). Another example of using BCX to translate to C code and modify to something Dev-C++ can handle. Enjoy!!!

Member Avatar for triumphost
0
4K
Member Avatar for vegaseat

If you use the Windows OS, then IronPython allows you to create a GUI program taking advantage of the .NET framework. You also have the option to compile the program into a standalone .exe file (and the needed .dll file).

Member Avatar for vegaseat
3
584
Member Avatar for j.heller

Tkinter can not play animated gif files. The GUI toolkit that does this well is PyQT or PySide. See example at ... http://www.daniweb.com/software-development/python/code/476999/play-animated-gif-files-with-pyside You could break up the animated gif into its individual gif files and sequence it so it plays on Tkinter. There are are a couple of tools …

Member Avatar for vegaseat
0
501
Member Avatar for help distressed

I use my IPad for information, but don't consider it a real computer. It is just too awkward to write a scientific program with it, even though I found a good Python IDE app for it. I do find myself touching the screen of my older laptop a lot.

Member Avatar for Ancient Dragon
0
501
Member Avatar for ckide
Member Avatar for vegaseat

Using the Python Image Library (PIL) you can resize an image. Several filters can be specified. ANTIALIAS is best for downsampling, the other filters work better with upsampling (increasing the size). In this code snippet one image of each filter option is saved, so you can compare the quality in …

Member Avatar for Budy_1
0
73K
Member Avatar for Diego_4

s.upper() Returns a copy of string s converted to uppercase Also see ... http://www.daniweb.com/software-development/python/threads/476338/print-a-string-backwards#post2080599

Member Avatar for mosquitohippy
0
249
Member Avatar for vegaseat
Member Avatar for kostas89
2
12K
Member Avatar for ckide

Nice find! Alas, IronPython and Jython are missing. Well, here is the Jython example ... ''' jy_HelloWorld7a.py create a frame with title 'Hello, World!' Java style ''' from javax.swing import JFrame f = JFrame('Hello, World!') f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE) f.setSize(300, 300) f.setLocationRelativeTo(None) f.setVisible(True) Not sure if IronPython still exists since MS dumped it …

Member Avatar for vmanes
0
415
Member Avatar for varshaholla

Maybe this will help ... # pick images you have in the working directory # or give full path image1 = tk.PhotoImage(file='Farm.gif') # create a label to display the image label = tk.Label(root, image=image1, relief='raised', bd=10) label.grid(row=1, column=1) # save label image from garbage collection! label.image = image1

Member Avatar for vegaseat
0
890

The End.