problems updating label and selfmade progressbar (kivy programming)

I am currently developing a small GUI for a project at university. Basically the GUI is supposed to be able to display some info about a process, and have a progressbar.

For some reason the first sequence of methods works well – the text label gets updated, the progressbar works. However when I press the second button, no updates are shown on the screen anymore. When I debug the code, I can see, that all the updates are working in the background – just – for whatever reason, these updates are not shown on screen. Can anyone help me?

When pressing the start button I want to clear the progressbar and eventually update some textlabels. For debugging reasons I am currently only working on clearing the progressbar, since none of these tasks seem to work so far.

The homing sequence (from home_rebuilder until home_stop) works perfectly well. I don’t understand, why after pressing start() nothing works anymore.

I inserted Debugging messages all over my code. These show that the code is working fine in the background, however my screen doesn’t want to show these updates:

I have also started to make some global variables. This helps some, but doesn’t solve all my issues with the code

#Queues
queues: SystemQueues = SystemQueues()
bilderkennung_to_gui = queues.gui_bilderkennung_rx
gui_to_bilderkennung = queues.gui_bilderkennung_tx
pathing_to_gui = queues.gui_pathing_rx
gui_to_pathing = queues.gui_pathing_tx

home_started = False
progress_count = 1

def __init__(self, **kwargs):
    super().__init__(**kwargs)
 
    #initialize variables
    self.time_started = False
    self.time_seconds = 0
    self.progress_started = False
    
    self.energy_started = False

    #Reset counter
    
    #Schedule Queue Handler
    Clock.schedule_interval(self.queue_handler, 1)

    """if GuiWindow.pathing is None:
        GuiWindow.pathing = PathingFactory.setup_pathing(self.queues)
    
        #initialize threads
        GuiWindow.pathing_thread = Process(target=self.pathing.run)
        GuiWindow.cube_detection_thread = Process(target=init_cube_detection, args=(self.queues, ))"""
    

def queue_handler(self, get_pathing):
    try:
        # check for object in pathing queue
        if not GuiWindow.pathing_to_gui.empty():
            get_pathing = GuiWindow.pathing_to_gui.get_nowait()
        else:
            get_pathing = None
        
        prev_get_pathing = None
        
        #Debug Logger entry, if Pathing-Queue updated
        if get_pathing == prev_get_pathing:
            pass
        else:
            prev_get_pathing = get_pathing
            Logger.info(f"Pathing to gui = {get_pathing}")
        
        # Check if object in cubedetector queue
        if not GuiWindow.bilderkennung_to_gui.empty():
            get_bildanalyse = GuiWindow.bilderkennung_to_gui.get_nowait()
        else:
            get_bildanalyse = None

        # Debug Logger entry, if CubeDetector Queue updated
        prev_get_bildanalyse = None
        if get_bildanalyse == prev_get_bildanalyse:
            pass
        else:
            prev_get_bildanalyse = get_bildanalyse
            Logger.info(f"Bildanalyse to gui = {get_bildanalyse}")
        
        if isinstance(get_pathing, Setup):
            self.home_update(get_pathing)
        elif isinstance(get_pathing, MeasureResults):
            self.energy_update(get_pathing)
        elif isinstance(get_pathing, Build) or isinstance(get_bildanalyse, Analyse):
            self.start_update(get_pathing, get_bildanalyse)
        elif isinstance(get_pathing, Reset):
            self.reset_update(get_pathing)
        elif isinstance(get_pathing, Emergency):
            self.emergency(get_pathing)
                
    except Empty:
        Logger.debug("Die Queue ist leer")
    except Exception as e:
        Logger.debug(f"Fehler aufgetreten {e}")

#automatic homing when starting 3drebuilder the first time
def home_rebuilder(self):
GuiWindow.home_started = True
Logger.info(f”Homing started {self.home_started}”)
command = Setup(“home”)
GuiWindow.gui_to_pathing.put(command)

    Clock.schedule_once(self.fake_homing,1)

#Fake homing_answer
def fake_homing(self, dt):
    command = Setup(None, "ack")
    GuiWindow.pathing_to_gui.put(command)

    Clock.schedule_once(self.fake_homing_two, 9)

def fake_homing_two(self, dt):
    command = Setup(None, "done")
    GuiWindow.pathing_to_gui.put(command)

def home_update(self, get_pathing: Setup):
    Logger.info("Home_update called")
    if GuiWindow.home_started:
        if get_pathing.ans == "ack":
            self.update_progress_label("Bitte warten..")

            zeiten = [0.1, 1.5, 2.2, 3.9, 5.2, 6.7, 8, 9.4]
            for zeit in zeiten:
                Clock.schedule_once(self.update_progress_bar, zeit)
            
        elif get_pathing.ans == "done":
            self.update_progress_label("Gerät ist betriebsbereit.")
            Clock.schedule_once(self.update_progress_bar, 0)
            self.ids.start.disabled = False
            self.ids.reset.disabled = False
            self.home_stop()

def home_stop(self):
    if GuiWindow.home_started:
        GuiWindow.home_started = False
        Logger.info(f"Home started {GuiWindow.home_started}")

def update_progress_label(self, text):
    self.ids.progress_label.text = text
    Logger.info(f"Progress_Label zeigt: {self.ids.progress_label.text}")

def update_progress_bar(self, dt):
    Logger.info("Update Progressbar called")
    if GuiWindow.progress_count <= 9:
        cube_id = "p"+str(self.progress_count)
        cube = self.ids.get(cube_id, None)
        cube.status = "highlight"
        GuiWindow.progress_count +=1
    else:
        pass

def clear_progress_bar(self): #FDoesn't work smh..
    Logger.info("Clear Progressbar called")
    GuiWindow.progress_count = 1
    Logger.info(f"Progress count {GuiWindow.progress_count}")
    self.update_gui()
    for i in range(1,10):
        cube_id = "p"+str(i)
        cube = self.ids.get(cube_id, None)
        Logger.info(f"Cube status {cube.status}")
        if cube:
            Cube.on_status_change(self, cube, None)
        else:
            Logger.error("Cube nicht erkannt")
    self.update_gui()
    

#Start_Button pressed
def start(self):
    if not GuiWindow.home_started:
        #clear progressbar
        self.clear_progress_bar()

    else:
        Logger.info("Es laufen noch Hintergrundprozesse. Start wird zurückgestellt.")

    #Clock.schedule_once(self.start_zwei)
    #Clock.schedule_once(self.start_drei)
    #Clock.schedule_once(self.start_vier)


#is currently deactivated - but just to show what I would like to implement    
def start_zwei(self, dt):
    Logger.info("Start_zwei was called")
    #ask for measurements of current
    command = Control("start")
    GuiWindow.gui_to_pathing.put(command)
    GuiWindow.gui_to_bilderkennung.put(command)
    
    #Label update
    self.update_progress_label("Bildanalyse initialisieren")

This is what it should look like (–> picture from going through the “homing” sequence)

homing sequence

After pressing start: no clearing of progressbar – no update of labels (text, timer, measurements) when activated in the code
enter image description here

New contributor

newb is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật