4,305 Posted Topics

Member Avatar for novice20
Member Avatar for samaru

A jpeg picture encrypter/decrypter I wrote for a friend, after his little brother spread the somewhat compromising digital pictures he took of his fiancee amongst his play buddies. Sorry, I don't have those pictures! It wasn't too difficult, but had to be done right now!

Member Avatar for Fest3er
0
3K
Member Avatar for vegaseat

The snippet shows how to create a menu on a windows form and test it. Original code via BCX, modified to compile with Dev C++ as a Windows Application. This approach does speed up writing of GUI programs.

Member Avatar for iman_1
1
5K
Member Avatar for vmanes

Don't you just hate it when... people smear their signature spam all over.

Member Avatar for JamesCherrill
0
563
Member Avatar for jrcagle

At first glance and play --> nice game, but I would like to know which player's turn it is. You could put that into the title, or color the line for each player (red or blue).

Member Avatar for Jiten_1
-1
6K
Member Avatar for Ancient Dragon

These two strings walk into a bar and sit down. The bartender says, "So what'll it be?" The first string says, "I think I'll have a beer quag fulk boorg jdkCjfdLk jk3s d#f67howeU r89nvyowmc63Dz x7xvcu" "Please excuse my friend," the second string says, "He isn't null-terminated."

Member Avatar for jkon
4
4K
Member Avatar for vegaseat
Member Avatar for Daniele_2
4
19K
Member Avatar for Kippstah

Here is an example of a function returning two arguments ... [code]def get_name(): """this function returns 2 arguments""" first = "Fred" last = "Ferkel" return first, last first, last = get_name() print( first + " " + last ) # Fred Ferkel [/code]

Member Avatar for balaji_8
-1
17K
Member Avatar for Niloofar24
Member Avatar for mattyd

Python, in an attempt to be more readable, uses 'and' and 'or' rather then '&&' and '||'. I think some international versions of C++ also have gone to this, because not all international keyboards have the '&' or "|" characters. In your case you would have to use ... [code]if …

Member Avatar for rahul_64
0
53K
Member Avatar for vegaseat

This class gives a specified Tkinter widget a tooltip that appears as the mouse is above the widget. You can improve the code by putting in a time delay.

Member Avatar for Marc_10
7
13K
Member Avatar for SpectateSwamp

I admit some YouTube videos are fun, but cataloging them seems to be a royal waste of time. I always thought that they were not kept around for long.

Member Avatar for Subraa_1
-3
457
Member Avatar for vegaseat

PySide (public license PyQT) is my preferred Python GUI toolkit. Here we explore how to test some of the widgets available and create a digital clock.

Member Avatar for Gribouillis
3
2K
Member Avatar for adanaz

My advice, run it from IDLE and you get an adjustable output window with a nice background that works across several common platforms.

Member Avatar for DubWine
0
18K
Member Avatar for vegaseat

This code creates a sound file in Sun's simple AU audio format of a sine wave of given frequency, duration and volume.

Member Avatar for samson.dadson.3_1
1
2K
Member Avatar for vegaseat

Sometimes when you get a large check from your employer, the value is written out in words. I get those all the time of course. So I wrote this little Python code to convert an integer value to english words. Numbers as high as 999 vigintillion can be used. In …

Member Avatar for Abdullahi_2
3
11K
Member Avatar for john_beginner

Please take a look at: [url]http://www.daniweb.com/forums/post107016.html#post107016[/url]

Member Avatar for Reverend Jim
0
21K
Member Avatar for vegaseat

Another application of Python module base64, this time to embed midi music data in your program. You also need the module pygame to execute this Python code. Enjoy the music!

Member Avatar for Rufus_1
5
12K
Member Avatar for ruwach

Use readlines() to get a list of lines ... [code=python]# read a text file as a list of lines # find the last line, change to a file you have fileHandle = open ( 'test3.txt',"r" ) lineList = fileHandle.readlines() fileHandle.close() print lineList print "The last line is:" print lineList[len(lineList)-1] # …

Member Avatar for gunjan_3
0
63K
Member Avatar for wai.yan.9678
Member Avatar for mike_2000_17

An email sent to a close friend should not be read by any pimple faced government intern, whose father happened to contribute big to one of our politicians. So, it would be simple to write a short program to encrypt the thing. Now I am afraid that the government snoops …

Member Avatar for Reverend Jim
2
2K
Member Avatar for vegaseat

You can put an image and text on a Tkinter button widget. This small code shows you how. The GIF image file you want to use for the button should be in the working directory, or you have to give it the full path. Incorporate the Python Image Library (PIL) …

Member Avatar for neon_3
1
23K
Member Avatar for vegaseat

Just a relatively simple calculator using the Tkinter GUI. It has a few nice features such as correcting division by an integer (for older Python versions), error trapping, to and from memory buttons, and an editable display. The editable display allows you to backspace mistakes, and also to enter things …

Member Avatar for Charles_24
5
10K
Member Avatar for vegaseat

A little calculator written in BCX basic and then translated to C code and modified to compile with Dev C++ (GCC/G++). Once you find your way past the standard GUI gibberish you can figure it out. For those who need some hand holding with the Dev C++ IDE: In the …

Member Avatar for rproffitt
1
6K
Member Avatar for a1eio

Here is one that works on Windows machines with Python3 ... [code=python]# open and close the CD tray door (Windows OS) # tested with Python 3.1 import ctypes import time # open the CD tray door ctypes.windll.winmm.mciSendStringW("set cdaudio door open", None, 0, None) # wait 3.5 seconds time.sleep(3.5) # close …

Member Avatar for Mahmoud_16
0
5K
Member Avatar for DaleGriff

Yes, you can do it with the help of Python module thread ... [code]# using VPython (visual) and Tkinter together # with the help of Python module thread # tested with VPython 5.4.1 and Python 2.7.1 by vegaseat import visual as vs import Tkinter as tk import thread # will …

Member Avatar for 令佳
1
2K
Member Avatar for vegaseat

Lots of good instrumental music out on the web in the form of midi files. You can incorporate background music as part of your web page. Here is the short code.

Member Avatar for Johannes_2
0
5K
Member Avatar for vegaseat

A little fun with Python's turtle module drawing a number of random stars in the dark sky.

Member Avatar for Ali_65
2
11K
Member Avatar for inkcoder

Start coding and if youu have problems, post your code and error message in a new thread here on DaniWeb. We will be glad to help you.

Member Avatar for Gabriel_9
1
49K
Member Avatar for sandman64
Member Avatar for mms6

If the OP has not even given an example of what has been tried, I would prod them to at least give an idea of how they would approach the solution. Then you can give hints how to proceed. Another way to help is to give a related example that …

Member Avatar for Hassaan_4
-2
894
Member Avatar for PCSAWICK829

A Fortran version of Zork was available in 1975 for the then popular DEC PDP-11 computers. It was later rewritten in C. I think the author of your book wants you to play the game and to apply the basic concepts to a potential Python game.

Member Avatar for Conrad_2
0
9K
Member Avatar for AutoPython

Here is an example of a Tkinter key logger ... [code=python]# KeyLogger_tk2.py # show a character key when pressed without using Enter key # hide the Tkinter GUI window, only console shows try: # Python2 import Tkinter as tk except ImportError: # Python3 import tkinter as tk def key(event): """shows …

Member Avatar for Gribouillis
1
49K
Member Avatar for vegaseat
Member Avatar for vegaseat

Use Python module threading to count intervals (in seconds) in the background. You can use this to time any relatively slow event like the time it took to finish a game or play some music. You can also peek at the current interval value as the event goes on. Go …

Member Avatar for Viresh_2
0
9K
Member Avatar for vegaseat

A list of class objects mimics a C array of structures. The snippet explores how to setup the list, and sort the list according to a selected attribute. Then we use a format string to display the sorted list. Take a look at how to search the list. All in …

Member Avatar for Gribouillis
2
125K
Member Avatar for sabbib

Tkinter's Entry widget allows the user to input a string. In your case this string has to be converted to a number for calculations. Another option for user input is to use Tkinter's pop-up dialogs that give you some control over what the user enters. Here is an example ... …

Member Avatar for Judith_2
0
1K
Member Avatar for IIMorphII

Just an untested WAG ... [code]import pygame from pygame.locals import * pygame.init() screen = pygame.display.set_mode((640,480), FULLSCREEN) # get the size of the fullscreen display x, y = screen.get_size() [/code]There is also a pygame.display.Info() call you can print.

Member Avatar for diliupgabadamudalige
0
17K
Member Avatar for aaron.breen.50

To get a nice display you need to use a GUI toolkit like the one that comes with your Python installation. Here is an example, study it carefully ... ''' tk_counter_down101.py count down seconds from a given minute value using the Tkinter GUI toolkit that comes with Python tested with …

Member Avatar for rproffitt
0
8K
Member Avatar for bumsfeld
Member Avatar for almostbob

"You put ten monkeys on computers and they will eventually come with a better program than you did!" "It will only take ten minutes for them to come up with most Linux commands."

Member Avatar for almostbob
6
561
Member Avatar for vegaseat

The Tkinter GUI toolkit comes with a scrolled text widget that is called ScrolledText. To get access to it you have to import it separately. It allows you to display large amounts of text in a small space.

Member Avatar for toyota_1
0
12K
Member Avatar for vegaseat

If you have a long message to display in a large readable font, then this little Tkinter GUI toolkit code might help.

Member Avatar for Mohamed_65
1
4K
Member Avatar for harshguy

Apple's **Xcode IDE** (free download) comes with 4 languages ... C C++ Objective C Swift When you start a new project it will ask which of these you want to use. I would dump the instructor that insists on using Turbo C++! Just too lazy to change lecture notes. That …

Member Avatar for mackit
0
1K
Member Avatar for vegaseat
Member Avatar for Mattia_1

Here is the most basic approach ... sentence = "Hello, my name is Mattia" # default split is at whitespace for word in sentence.split(): print(word) ''' result ... Hello, my name is Mattia ''' I leave it to you to separate the comma from Hello.

Member Avatar for Onion13
0
3K
Member Avatar for vegaseat

The module pyglet leans on OpenGL for graphics and is used in the scientific community together with Python. This short code snippet shows you how to use it to display an animated GIF file. The download is free, so give it a try. You don't have to download OpenGL to …

Member Avatar for kwekey
4
17K
Member Avatar for vegaseat
Member Avatar for rockingjohncart
0
334
Member Avatar for vegaseat

Just a simple exploration of the goslate module (uses the Google Translate API) to translate some common languages. However, some IDE's create character problems. Note: Your computer has to be connected to the Internet to access Google.

Member Avatar for Ekta_1
3
2K
Member Avatar for needs_help
Member Avatar for Ciara_1
0
883

The End.