4,305 Posted Topics
Re: You could save the flag to file and read it in the second script. | |
Re: 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! | |
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. | |
Re: Don't you just hate it when... people smear their signature spam all over. | |
Re: 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). | |
Re: 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." | |
Shows how to create a basic slide show with the Python Tkinter GUI toolkit. | |
Re: 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] | |
Re: Which tutorial are you using? | |
Re: 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 … | |
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. | |
Re: 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. | |
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. | |
Re: My advice, run it from IDLE and you get an adjustable output window with a nice background that works across several common platforms. | |
This code creates a sound file in Sun's simple AU audio format of a sine wave of given frequency, duration and volume. | |
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 … | |
Re: Please take a look at: [url]http://www.daniweb.com/forums/post107016.html#post107016[/url] | |
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! | |
Re: 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] # … | |
Re: Our friend ryantroop says it all! | |
Re: 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 … | |
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) … | |
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 … | |
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 … | |
Re: 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 … | |
Re: 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 … | |
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. | |
A little fun with Python's turtle module drawing a number of random stars in the dark sky. | |
Re: 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. | |
Re: 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 … | |
Re: 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. | |
Re: 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 … | |
A short example of Pygame showing an image with a known internet url. | |
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 … ![]() | |
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 … | |
Re: 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 ... … | |
Re: 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. ![]() | |
Re: 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 … | |
Re: Do you have the Adobe Acrobat Reader installed? | |
Re: "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." | |
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. | |
If you have a long message to display in a large readable font, then this little Tkinter GUI toolkit code might help. | |
Re: 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 … | |
This simple key logger shows any character/special key when pressed. | |
Re: 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. | |
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 … | |
My yellow VW Beetle is 10 years old. It does very well out here in the desert. | |
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. | |
Re: [url]http://img836.imageshack.us/img836/1097/countthedots.gif[/url] |
The End.