创建后,我希望将tkinter窗口移动到不同的x和y坐标。例如,创建窗口后5秒钟,将其移至
x = ???和y = ???。
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js" integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy" crossorigin="anonymous"></script>
<div class="container-fluid marketing-main-header">
<div class="marketing-main-header_banner">
<div class="sample">
<nav class="navbar navbar-expand-lg navbar-light">
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNav"
aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarNav">
<ul class="navbar-nav ml-auto marketing-navbar">
<li class="marketing-navbar_items nav-item">
<a class="marketing-nav-link nav-link" href="#">Dla kogo </a>
</li>
<li class="marketing-navbar_items nav-item">
<a class="marketing-nav-link nav-link" href="#">Agenda</a>
</li>
<li class="marketing-navbar_items nav-item">
<a class="marketing-nav-link nav-link" href="#">Prowadzacy</a>
</li>
<li class="marketing-navbar_items nav-item">
<a class=" marketing-nav-link nav-link " href="#">Faq</a>
</li>
<li class="marketing-navbar_items nav-item">
<a class="marketing-nav-link nav-link " href="#">Kontakt</a>
</li>
<li class="marketing-navbar_items nav-item">
<a class="marketing-nav-link nav-link " href="#">Kompetencje</a>
</li>
</ul>
</div>
</nav>
<div class="marketing-main-header_details">
<div class="marketing-main-header_logo">
<img src="https://thumb.ibb.co/hPrhZp/logo_mib.png">
</div>
<div class="marketing-main-header_title">
<h1>SZKOLENIA</h1>
</div>
<div class="marketing-main-header_description">
<p>Lorem ipsum dolor sit amet, an pro dicta maiorum recusabo.</p>
</div>
<div class="marketing-main-header_sub-description">
<p>Lorem ipsum dolor sit amet, an pro dicta maiorum recusabo.</p>
</div>
<div class="marketing-main-header_button">
<button type="button" class="marketing-main-header_button-primary">Poznaj Agende</button>
</div>
</div>
</div>
</div>
</div>
上面的代码只是一个例子,如何对其进行修改以自行移动?
答案 0 :(得分:0)
此示例将向您展示如何重置控制窗口在屏幕上位置的根几何;单击图像将切换窗口的位置。
import React from 'react';
import { StyleSheet, Dimensions, View } from 'react-native';
import Pdf from 'react-native-pdf';
class PDFExample extends React.Component {
componentDidMount() {
this.makeRemoteRequest();
}
makeRemoteRequest = () => {
const url = `some other url/${this.props.navigation.params.qtext}`;
.. some other code that won't run because i can't get qtext ..
render() {
return (
.....
)
}
}
(注意,您遇到的挑战性游戏是赶上关闭窗口的时间)
from tkinter import *
def move_me(idx=[0]): # <- creates a closure for the index of the location strings
loc = ["300x300+200+200", "300x300+300+300"]
root.geometry(loc[idx[0]]) # <-- reset the geometry
idx[0] = (idx[0]+1) % 2 # <-- toggles the index between 0 and 1
root = Tk()
root.title("lol")
root.geometry("300x300-100+100")
photo = PhotoImage(file="pepe.gif")
button = Button(root, image=photo, command=move_me)
button.place(x=10, y=10)
root.mainloop()