A simple way to create a toggle button for the Tkinter Python GUI toolkit.

Member Avatar
Member Avatar
+1 forum 8

Pretty neat text-based RPG that I made. Currently my first game.

Member Avatar
Member Avatar
+0 forum 18

Above program takes input of coefficient and power separately of 2 different polynomials add them up to a new polynomial.It is successfully compiled and executed in DEV CPP as C file.It Turbo C compiler add void before main function to avoid warning messages.

Member Avatar
Member Avatar
-1 forum 7

This code shows how to obtain and display a GIF image from an internet website using the Tkinter GUI toolkit that comes with the Python installation.

Member Avatar
Member Avatar
+4 forum 7

I was so amazed at how easy it was to embed google maps into a vb app I decided to post a quick example to help anyone get started. This is a simple example. Google's api has all kinds of things to help customize your map. You can find out anything you need to know from here: [url]http://code.google.com/apis/maps/documentation/javascript/reference.html[/url] You will need to: Create a new windows forms app. Add a class named GoogleControl and paste the GoogleControl code into it. Add a new html doc to the project and name it GoogleMap.htm and set its Build action to CopyIfNewer Copy …

Member Avatar
Member Avatar
+4 forum 46

This snippet converts a CIDR notated IP address to a range of IP addresses in decimal, dotted notation. Eg.: 192.168.1.255/31 => 192.168.1.254 - 192.168.1.255

Member Avatar
Member Avatar
+0 forum 2

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
Member Avatar
+1 forum 2

Let's say you want to send a short private message to your friend, but don't want grandma to snoop around and find it. One way is to use the Python Image Library (PIL) and hide the message in a picture file's pixels. Just looking at the picture you will barely detect any difference between the before and after picture. All your friend needs is the decode_image portion of this simple code to get the message back.

Member Avatar
Member Avatar
+5 forum 11

This short Python code gets the local time from the PC as a formatted string using time.strftime('%H:%M:%S'). The time string is displayed in a label using a larger font. A recursive function checks the time five times per second, and updates the time string, if it has changed. Five times per second may sound like overkill, but keeps the display from acting spasmodic.

Member Avatar
Member Avatar
+2 forum 12

Several people have asked how to export data to Excel. This code snippet shows how to export the data from a listview in details mode to a new Excel spreadsheet. Take note of the comments in the header to avoid having orphaned Excel.exe tasks eat up your system memory.

Member Avatar
Member Avatar
+7 forum 15

The present code snippet just does an especific task. This is, given an ordered sequence of natural numbers, starting at zero, generate all the different permutations there can be. When we talk about permutations, the order of the sequence does matter. So, the sequence 0, 1, 2 differs from 2, 0, 1. For example, think about a 4-7-2 lock combination sequence. Changing the sequence to 2-7-4 would not open the lock, of course. Properly speaking in mathematics, we are talking about permutations, because the order does matter. On the other hand, if the order did not matter, we would be …

Member Avatar
Member Avatar
+0 forum 9

Hey, i was just mucking around and improving my code etc and made a calculator, it's not the best calculator in the world, it only can handle 1 or 2 numbers but i think it's good my self :).

Member Avatar
Member Avatar
+0 forum 8

Shows how to create a basic slide show with the Python Tkinter GUI toolkit.

Member Avatar
Member Avatar
+4 forum 19

This simple isprime(number) function checks if the given integer number is a prime number and returns True or False. The function makes sure that the number is a positive integer, and that 1 is not considered a prime number. To find out if an integer n is odd one can use `n & 1`, to check for even one can then use `not n & 1` or the more traditional `n % 2 == 0` which is about 30% slower.

Member Avatar
Member Avatar
+2 forum 35

Yes, WPF. The learning curve is steep, but what amazing things you can do with it! Look at this hexagon window for instance. Serves no purpose in a business environment I guess, but in a gaming situation it could work. For me, it was just fun to get this up and running. I’m using VS 2017. Start up a new WPF window project. Call it HexagonWindow and fill in the missing code. I still don’t understand all the intricacies of WPF, I’m just a mere mortal human being, but my quest on the subject is ongoing. Why don’t some of …

Member Avatar
Member Avatar
+0 forum 2

Well inside the windows operating system there are predefinided dialog boxes. We can use it freely with little effort. Think that you have to get a input file name or file path. The traditional way of doing this is parsing the command line arguments.But here we are in win32 , so we should use GetOpenFileName simple GetOpenFileName just getting an pointer to a data structure OPENFILENAME that defined on Commdlg.h header file. so we just create that structure on the memory and passing pass it's pointer as an argument to the GetOpenFileName function. and after that returns it normally fills …

Member Avatar
Member Avatar
+0 forum 5

This Program implements the Predictive Parsing Of the grammar E->E+T/T F->F*T/F F->id(Identifier)

Member Avatar
Member Avatar
+0 forum 7

This is a remake of the Simple Equation Solver snippet that is written in Java. This is an equivalent version written in C++.

Member Avatar
Member Avatar
+1 forum 7

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
Member Avatar
+7 forum 4

This is one small snippet of after event usage. You could express if you find this kind of simple code to be usefull as snippet. Notice also vegaseat's sticky message threads in begining of Python forum in addition to code snippets.

Member Avatar
Member Avatar
+0 forum 4

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
Member Avatar
+3 forum 2

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
Member Avatar
+1 forum 4

When working with TCP client sockets I often find myself frustrated with the lack of event-driven support. I usually end up writing a whole bunch of code to determine disconnects, reconnecting, etc and I figuired it's time to just write my own class for this stuff. I figuired I'd share it with all of you. The implementation is quite simple, I'll provide an example below. I have XML commented all the public properties and methods, the rest is up to you to figuire out if you want to make any changes! public partial class Form1 : Form { EventDrivenTCPClient client; …

Member Avatar
Member Avatar
+5 forum 16

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 case you don't know, a vigintillion is 10 to the power 60. That is what our national deficit will be soon.

Member Avatar
Member Avatar
+3 forum 4

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
Member Avatar
+5 forum 9

[OH noo, please not that again!](https://www.youtube.com/watch?v=DvShTJKuy2w) Yeah, primes sigh. But they play a minor role here as a perfect victim to explain some other things. Would not advise to use the algorithm here to calculate them in real life. There are languages like Python, F#, Haskell etc. who have list comprehension on board. I was wondering how to do it in C#. Looked up some examples on the net and concoct my own here. See the `factors` method on line 84 and the `primes` method on line 109. What I like about this code is that it is so concise …

Member Avatar
Member Avatar
+0 forum 2

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) for other image formats.

Member Avatar
Member Avatar
+1 forum 3

Hey everybody, Lately I have written the game Hangman in many different languages (C, JavaScript, Java and PHP so far). Here is the code snippet for C! It uses a words file, on the bottom of this post you will see a small example of a few words. You can adjust the default words file in the getWord() function (line 164). If the file does not exist, the script will ask for another words file. The words need to be separated by a |. Words files can be found can be found [URL="http://www.hangman.symbolwebdesign.nl/wordsfiles.php"]here[/URL]. ~G words.txt [CODE]abbey|abruptly|affix|askew|axiom|azure|bagpipes|bandwagon|banjo|bayou|bikini|blitz|bookworm|boxcar|boxful|buckaroo|buffalo|buffoon|cobweb|croquet|daiquiri|disavow|duplex|dwarves|equip|exodus[/CODE]

Member Avatar
Member Avatar
+0 forum 3

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 not on the key pad, like hexnumbers. For instance if you enter 0xFF and press equals, it will give you the decimal (denary) equivalent of 255 The program also has a guard against the bad guys that like to abuse the underlying eval() function to wipe out files. I wrote …

Member Avatar
Member Avatar
+5 forum 14

This snippet defines a function restart_program() which restarts your python program from within your python program.

Member Avatar
Member Avatar
+4 forum 27

The End.