0

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()
4
Contributors
4
Replies
35
Views
4 Years
Discussion Span
Last Post by antonio.neal.39
0

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

Edited by pyTony

0

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()

Edited by woooee

0

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.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.