如何在配对小程序中获取窗口原点(位置)?(How to get window origin (position) in mate applet?)
我尝试在配合面板小程序中获取窗口原点。
更确切地说,我想知道我的小程序(x和y)在屏幕上的位置,因为我有一个显示/隐藏Gtk.window
的按钮,但我需要将该窗口移动到我的按钮旁边(上方,下方,右,左,取决于配合面板的位置)我找到的唯一方法是调用
get_origin
但是有问题。 它应该返回一个元组x,y,但是就像c函数一样,它需要两个整数,因为python使用传递值当然不起作用。此代码有效但无用:
window = self.get_window() x = 0 y = 0 window.get_origin(x, y)
所有其他“使用方法”
get_origin
(您可以在任何文档中找到)都不起作用,因为它需要3个args(我不知道为什么)所以我正在寻找一种方法来获取我的applet的位置(即使它不准确)或者将我的窗口移动到我的按钮旁边。
I try to get window origin in a mate panel applet.
To be more precise I want to know the position of my applet (x and y) on the screen because I have a button which show/hide aGtk.window
but I need to move that window next to my button (above, below, right, left depending on where the mate panel is)The only way that I found is to call
get_origin
but there is a problem. It should return a tuple x,y but instead like the c function it require two integers and since python use pass by value of course it doesn't work.This code is valid but useless:
window = self.get_window() x = 0 y = 0 window.get_origin(x, y)
All other "way to use"
get_origin
(that you can found in any doc) does not work because it require 3 args (I don't know why)So I'm looking for a way to get the position of my applet (even if it's not accurate) or to move my window next to my button.
原文:https://stackoverflow.com/questions/36489066
最满意答案
> df = pd.DataFrame({'seconds_since_midnight': [34200.934549345, 34205.735545344]}) > df['actual_date'] = (df.seconds_since_midnight * 1e9).astype('timedelta64[ns]') + pd.to_datetime('2011-01-10') > df seconds_since_midnight actual_date 0 34200.934549 2011-01-10 09:30:00.934549345 1 34205.735545 2011-01-10 09:30:05.735545344 [2 rows x 2 columns]
> df = pd.DataFrame({'seconds_since_midnight': [34200.934549345, 34205.735545344]}) > df['actual_date'] = (df.seconds_since_midnight * 1e9).astype('timedelta64[ns]') + pd.to_datetime('2011-01-10') > df seconds_since_midnight actual_date 0 34200.934549 2011-01-10 09:30:00.934549345 1 34205.735545 2011-01-10 09:30:05.735545344 [2 rows x 2 columns]
相关问答
更多-
将纳秒转换为日期时间(Converting Nanoseconds to Datetime)[2022-12-21]
使用AddTicks方法。 不要忘记将纳秒除以100得到刻度。 long nanoseconds = 1449491983090000000; DateTime epochTime = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc); DateTime result = epochTime.AddTicks(nanoseconds / 100); Use AddTicks method. Don't forget to divide nanoseco ... -
如何将numpy datetime64转换为datetime [复制](How to convert numpy datetime64 into datetime [duplicate])[2022-08-19]
借用在日期时间,时间戳和日期时间64之间进行转换 In [220]: x Out[220]: numpy.datetime64('2012-06-17T23:00:05.453000000-0700') In [221]: datetime.datetime.utcfromtimestamp(x.tolist()/1e9) Out[221]: datetime.datetime(2012, 6, 18, 6, 0, 5, 452999) 考虑时区我认为是正确的。 虽然看起来很笨重。 astype('O' ... -
它们是当前(即使是在掌握)处理PeriodIndex NaT一些问题,所以你的方法不会那样工作。 但似乎你只是想重新取样; 这样做。 您当然可以指定一个函数,如果您想要的话。 In [57]: data Out[57]: 0 2014-10-01 1 2014-10-01 2 2014-10-31 3 2014-11-15 4 2014-11-30 5 NaT 6 2014-12-01 dtype: datetime64[ns] In [58]: df = Da ...
-
在datetime,Timestamp和datetime64之间进行转换(Converting between datetime, Timestamp and datetime64)[2022-04-16]
要将numpy.datetime64转换为datetime对象,该对象表示以numpy-1.8为UTC的时间: >>> from datetime import datetime >>> import numpy as np >>> dt = datetime.utcnow() >>> dt datetime.datetime(2012, 12, 4, 19, 51, 25, 362455) >>> dt64 = np.datetime64(dt) >>> ts = (dt64 - np.datetime6 ... -
如何将对象类型转换为python jupyter中的datetime64 [ns]?(how to convert object type to datetime64[ns] in python jupyter?)[2023-07-28]
如果需要date你也需要datetime s: quote['SellTime'] = pd.to_datetime(t2, format='%H%M%S') print (quote) SellTime 0 1900-01-01 09:45:20 1 1900-01-01 09:45:38 2 1900-01-01 09:46:09 3 1900-01-01 09:46:15 4 1900-01-01 09:46:17 或者更好的是将时间转换为timedelta s: quot ... -
这可能只是设置日期时间单位的问题: In [368]: dt = datetime.now() In [369]: dt Out[369]: datetime.datetime(2017, 12, 19, 12, 48, 45, 143287) np.array默认动作(不需要带列表的fromiter )是创建一个对象dtype数组: In [370]: np.array([dt,dt]) Out[370]: array([datetime.datetime(2017, 12, 19, 12, 48, ...
-
我相信Timestamp在很久以前的日期就会中断,因为没有关于如何处理各种闰秒的记录以及一直没有的事情。 所以你得到的错误是打破最精确的时间精度。 这就说得通了。 它说它很久以前就不会那么精确了。 解 请改用dt.datetime。 它不需要那么多精度。 import pandas as pd import datetime as dt epoch = dt.datetime(1582, 10, 15) date = dt.datetime(2016, 3, 31) int((date - epoch ...
-
将pandas列转换为datetime64,包括缺失值(Converting pandas columns to datetime64 including missing values)[2022-12-10]
如果你有一个全read_csv列,它将不会被read_csv正确read_csv 。 最简单的就是这样做(如果列已经是datetime64 [ns]将只通过)。 In [3]: df = DataFrame(dict(A = Timestamp('20130101'), B = np.random.randn(5), C = np.nan)) In [4]: df Out[4]: A B C 0 2013-01-01 00:00:00 -0.8 ... -
似乎pandas date_range正在删除时区(看起来像一个bug,我认为它已经提交了......),你可以使用Timestamp而不是datetime64来解决这个问题: In [11]: start = pd.Timestamp(date+'T09:30:00') In [12]: end = pd.Timestamp(date+'T16:00:00') In [13]: pd.date_range(start, end, freq='S') Out[13]:> df = pd.DataFrame({'seconds_since_midnight': [34200.934549345, 34205.735545344]}) > df['actual_date'] = (df.seconds_since_midnight * 1e9).astype('timedelta64[ns]') + pd.to_datetime('2011-01-10') > df seconds_since_midnight actual_dat ...
相关文章
更多- Java Applet基础
- 关于struts和applet整合的问题 谢谢啊
- 请教 JS 的 window open 问题
- 请问怎么applet怎么通过servlet连接数据库
- 基于window安装redis
- Window环境安装 Memcached
- 基于window配置Java开发环境
- IOS7 position:fixed 定位问题
- 解决Window环境下启动Hadoop时出现的 java.lang.NoClassDefFoundError: org/apache/hadoop/util/PlatformName 异常
- 在window平台怎样用JConsole监控linux服务器tomcat的环境搭建
最新问答
更多- 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
- 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
- OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
- 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
- codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
- 在计算机拍照在哪里进入
- 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
- No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
- 单页应用程序:页面重新加载(Single Page Application: page reload)
- 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
- System.StackOverflow错误(System.StackOverflow error)
- KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
- 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
- android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
- TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
- 企业安全培训的各项内容
- 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
- C#类名中允许哪些字符?(What characters are allowed in C# class name?)
- NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
- 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
- 将多个行和可变行移动到列(moving multiple and variable rows to columns)
- 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
- 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
- Angular $资源不会改变方法(Angular $resource doesn't change method)
- 在Angular 5中不是一个函数(is not a function in Angular 5)
- 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
- 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
- 常见的python rpc和cli接口(Common python rpc and cli interface)
- Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
- 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)