MCPcopy Index your code
hub / github.com/RustPython/RustPython / mainloop

Method mainloop

crates/stdlib/src/tkinter.rs:341–358  ·  view source on GitHub ↗
(&self, threshold: Option<i32>)

Source from the content-addressed store, hash-verified

339 // TODO: Fix arguments
340 #[pymethod]
341 fn mainloop(&self, threshold: Option<i32>) -> PyResult<()> {
342 let threshold = threshold.unwrap_or(0);
343 // self.dispatching = true;
344 QUIT_MAIN_LOOP.store(false, Ordering::Relaxed);
345 while unsafe { tk_sys::Tk_GetNumMainWindows() } > threshold
346 && !QUIT_MAIN_LOOP.load(Ordering::Relaxed)
347 && !ERROR_IN_CMD.load(Ordering::Relaxed)
348 {
349 if self.threaded {
350 unsafe { tk_sys::Tcl_DoOneEvent(0 as _) };
351 } else {
352 unsafe { tk_sys::Tcl_DoOneEvent(tk_sys::TCL_DONT_WAIT as _) };
353 // TODO: sleep for the proper time
354 std::thread::sleep(std::time::Duration::from_millis(1));
355 }
356 }
357 Ok(())
358 }
359
360 #[pymethod]
361 fn quit(&self) {

Callers

nothing calls this directly

Calls 3

sleepFunction · 0.50
storeMethod · 0.45
loadMethod · 0.45

Tested by

no test coverage detected