Can someone help me rewrite this java program in python. This program takes a message from the shell and flashes the message one word at a time.

Now I am supposed to rewrite it in python (tkinter), I have the gui done and my quit button works, but I cannot seem to figure the thread part out.

Please help this is due in 2 days and I only have 1/4 of it rewrote in python.

Thanks in advance.

Here is the program in java.

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class FlashingText extends JFrame implements ActionListener{

public static void main(String []args){
for (int i = 0; i < args.length; i++)
System.out.println("Args: " + args );

//Create the frame and set a title
JFrame frame = new JFrame ("Flashing Text");

JPanel textPanel = new JPanel();
Lights lights = new Lights (args);

//Set the frame layout
frame.setLayout(new FlowLayout());

//Create a quit button and add an action listener to the button

JPanel quitPanel = new JPanel();
JButton quitbutton = new JButton("QUIT");
quitbutton.addActionListener( new FlashingText () );

// Add the components to the frame
Container content = frame.getContentPane();

//Set the size of the frame and set to visible
frame.setSize(100, 50);
public void actionPerformed(ActionEvent ae){

Second class:

import java.awt.*;
import javax.swing.*;

public class Lights extends JPanel implements Runnable {

Font textFont = new Font("Serif", Font.BOLD, 20);
Thread runner;
JLabel [] input;

public Lights(String [] message) {

input = new JLabel [message.length];
for (int i = 0; i < message.length; i++){
input = new JLabel(message);

runner = new Thread(this);

void pause(int duration) {
try {
} catch (InterruptedException e) { }

public void run() {
while ( true ) {
for (int i = 0; i < input.length; i++){
input.setForeground(new Color (180, 150, 195));

for (int i = 0; i < input.length; i++){
input.setForeground (;

Member Avatar for iamthwee

ask that in the python forums

Sorry but you may not ask members to do your homework for you. It is against the forums guidelines. Please do this yourself and ask for help only when necessary.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.