4,305 Posted Topics
Re: "I wanna be cremated" very practical thinking. | |
Re: Java sounds like it is made for you. Google "colleges using java" | |
Re: 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. | |
Re: 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 … | |
Re: See also ... http://www.daniweb.com/software-development/c/code/216595/read-an-integer-from-the-user-part-2 | |
Re: A local anesthetic like the gel one uses on gums for a sore tooth might help. | |
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 … | |
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 … | |
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 … | |
Re: 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 … | |
Re: 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 … | |
Re: 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/ | |
Re: **in_file** is a file handle **indata** is a string containing the contents of the file | |
Re: 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 | |
Re: I was young then, only 58 years old. Made a webpage for Bullhead City Arizona. ![]() | |
Re: Explore with small code examples, then put them together to explore a project. | |
Re: 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 … | |
Re: 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! | |
Re: Can you give us an example of your code? | |
Re: Nice solution by BearofNH. Just a note, you can use print(card) with Python25 too. | |
Re: Where is class Frame2(wx.Frame)? | |
Re: I am showing my age ... "Canadian Sunset" by Hugo Winterhalter | |
Re: 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): … | |
Re: You can also use `print(type(ans))` | |
Re: **Yellowstone Park** is my taste. | |
Re: If you are moving a lot, you will hate those heavy boxes of paper books very quickly. | |
| |
Re: An odd one for the Mojave Desert, 68F (20C) and raining. | |
Re: 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")` | |
Re: I have done a lot of different languages over the years, but Python suites my feeble mind the best. | |
Re: For the real easy questions you might get too many answers (hits). | |
Re: Hint, use math.pow() and math.factorial() so `x4/4!` will be `math.pow(x, 4)/math.factorial(4)` | |
Re: 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 … | |
Re: 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 … | |
Re: 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 … | |
Re: 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 | |
Re: 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 … | |
Re: 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 … ![]() | |
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!!! | |
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). | |
Re: 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 … | |
Re: 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. | |
Re: I like #2 Got used to it writing lots of C code. | |
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 … ![]() | |
Re: 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 | |
This handy little utility determines the size of a folder and it's subfolders in MBytes. | |
Re: 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 … | |
Re: 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 |
The End.