I am working on a program for work and trying to make a massage bar with text can anyone help? I just want the text to move across the screen.

from tkinter import *
Gui = Tk()
Gui.geometry('8000x100+1+600')                 
Gui.title('ALARTS')
Gui.config (bg = 'blue')                       
massage = Label(Gui, text = 'this is a demo')
massage.config (fg = 'white',bg = 'blue', font=('times','60'))
massage.place( x = 1,y = 0,)
Gui.mainloop()

Recommended Answers

All 4 Replies

As long as you use Python3, this should run. Use the after method and winfo_x() method.

A simple example

class Massage_DontCallMeMessage():
    def __init__(self):
        gui = Tk()
        gui.geometry('1500x100+10+600')                 
        gui.title('ALARTS')
        gui.config (bg = 'blue')                       
        self.massage = Label(gui, text = 'this is a demo')
        self.massage.config (fg = 'white',bg = 'blue', font=('times','60'))
        self.massage.place( x = 1,y = 0,)

        self.ctr = 0
        self.change_it()
        gui.mainloop()

    def change_it(self):
        orig_text='this is a demo          '
        display_text = orig_text[-self.ctr:] + orig_text[:-self.ctr]
        self.massage["text"]=display_text
        self.ctr += 1
        if self.ctr > len(orig_text):
            self.ctr = 0
        self.massage.after(200, self.change_it)

MM = Massage_DontCallMeMessage()

thank you so much! ive been reading books and learning to code but most of the book just walk you through the basics and thats about it. so i can across this site and i love it.

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.