I am trying to make a card game programs using Fl_Tabs or Fl_Wizard but can't find any instructions on how to do so in pyFltk. Is there an example or any documentation showing the basic code of creating the Fl_Tabs because I couldn't find anything on the Internet.
from fltk import *
x=Fl_Tabs(20,20,500,500)
x.show()
Fl.run()
When I run the above program that, nothing will show.
Thanks in advance.
Example of how to use Fl_Tabs. This is a python version of the one from Erco's cheat page
#!/usr/bin/python
# python version of http://seriss.com/people/erco/fltk/#Fl_Tabs
# _____ _____
# __/ Aaa \/ Bbb \______________________
# | _______ |
# | |_______| |
# | _______ |
# | |_______| |
# | _______ |
# | |_______| |
# |______________________________________|
#
from fltk import *
def GroupAAA():
aaa = Fl_Group(10,35,500-20,200-45,"Aaa")
b1 = Fl_Button(50, 60,90,25,"Button A1"); b1.color(88+1)
b2 = Fl_Button(50, 90,90,25,"Button A2"); b2.color(88+2)
b3 = Fl_Button(50,120,90,25,"Button A3"); b3.color(88+3)
aaa.end()
def GroupBBB():
bbb = Fl_Group(10,35,500-10,200-35,"Bbb")
b1 = Fl_Button( 50,60,90,25,"Button B1"); b1.color(88+1)
b2 = Fl_Button(150,60,90,25,"Button B2"); b2.color(88+3)
b3 = Fl_Button(250,60,90,25,"Button B3"); b3.color(88+5)
b4 = Fl_Button( 50,90,90,25,"Button B4"); b4.color(88+2)
b5 = Fl_Button(150,90,90,25,"Button B5"); b5.color(88+4)
b6 = Fl_Button(250,90,90,25,"Button B6"); b6.color(88+6)
bbb.end()
win = Fl_Window(500,200,"Tabs Example")
tabs = Fl_Tabs(10,10,500-20,200-20)
GroupAAA()
GroupBBB()
tabs.end()
win.end()
win.show()
Fl.run()
Related
I want to have automate process for this program: TimeComX Basic.
The script i wrote:
from pywinauto.application import Application as PyWinAutoApplication
from pywinauto.timings import wait_until
from pywinauto.keyboard import send_keys
import pywinauto
import os
import sys
from pywinauto import mouse
import traceback
#Hidernate pc
app2 = PyWinAutoApplication(backend="uia").connect(found_index=0,title="TimeComX Basic")
handle = pywinauto.findwindows.find_windows(title="TimeComX Basic")[0]
window = app2.window(handle=handle)
window.maximize()
window.set_focus()
app2.TimeComxBasic.print_control_identifiers()
#mouse.click(button='left', coords=(150, 960))
Note that to run this script you have to manually install and open TimeComX Basic.
The output:
Control Identifiers:
Dialog - 'TimeComX Basic' (L-11, T-11, R1931, B1019)
['TimeComX BasicDialog', 'Dialog', 'TimeComX Basic']
child_window(title="TimeComX Basic", control_type="Window")
|
| TitleBar - '' (L24, T-8, R1920, B34)
| ['TitleBar']
| |
| | Menu - 'System' (L0, T0, R22, B22)
| | ['Menu', 'System', 'SystemMenu', 'System0', 'System1']
| | child_window(title="System", auto_id="MenuBar", control_type="MenuBar")
| | |
| | | MenuItem - 'System' (L0, T0, R22, B22)
| | | ['MenuItem', 'System2', 'SystemMenuItem']
| | | child_window(title="System", control_type="MenuItem")
| |
| | Button - 'Minimize' (L1707, T0, R1778, B33)
| | ['MinimizeButton', 'Button', 'Minimize', 'Button0', 'Button1']
| | child_window(title="Minimize", control_type="Button")
| |
| | Button - 'Restore' (L1778, T0, R1848, B33)
| | ['Restore', 'Button2', 'RestoreButton']
| | child_window(title="Restore", control_type="Button")
| |
| | Button - 'Close' (L1848, T0, R1920, B33)
| | ['Close', 'Button3', 'CloseButton']
| | child_window(title="Close", control_type="Button")
As you can see it has options only for close, minimize and maximize buttons and for main menu. There is no option to "Start" button for example.
What can I do in this situation?
I'm working with account-financial-reporting module (OCA).
I want to add tree structure according to Code :
if account.code = "xxx000" or "yyy000" , then change the line style to bold ,
and get the other codes in ascending order . Example:
Code | |
-------------------------
xxx000 | |
-------------------------
|xxx001 |
-------------------------
|xxx003 |
-------------------------
yyy000 | |
-------------------------
|yyy002 |
-------------------------
|yyy005 |
-------------------------
def _generate_report_content(self, workbook, report):
if not report.show_partner_details:
# Display array header for account lines
self.write_array_header()
# For each account
for account in report.account_ids.filtered(lambda a: not a.hide_line):
if not report.show_partner_details:
# Display account lines
self.write_line(account, 'account')
Any help please ?
I would like to use pywinauto to control an image processing software.
First, I need to click a specific area (which is used for image dragging) to pop up a windows for path input. See the first figure.
Then, I need to input a path and click the button "Select Folder". See the second figure.
I tried:
from pywinauto import Desktop, Application, mouse, findwindows
from pywinauto.keyboard import SendKeys
app = Application(backend='uia').start(r"C:\Program Files\Duplicate Photo Cleaner\DuplicatePhotoCleaner.exe")
app.connect(path="DuplicatePhotoCleaner.exe")
app.DuplicatePhotoCleaner.print_control_identifiers()
Control Identifiers:
Dialog - 'Duplicate Photo Cleaner' (L440, T126, R1480, B915)
['Duplicate Photo Cleaner', 'Duplicate Photo CleanerDialog', 'Dialog']
child_window(title="Duplicate Photo Cleaner", control_type="Window")
|
| TitleBar - '' (L464, T129, R1472, B157)
| ['', 'TitleBar']
| |
| | Menu - 'System' (L448, T134, R470, B156)
| | ['System', 'Menu', 'SystemMenu', 'System0', 'System1']
| | child_window(title="System", auto_id="MenuBar", control_type="MenuBar")
| | |
| | | MenuItem - 'System' (L448, T134, R470, B156)
| | | ['System2', 'SystemMenuItem', 'MenuItem']
| | | child_window(title="System", control_type="MenuItem")
| |
| | Button - 'Minimize' (L1333, T127, R1380, B157)
| | ['Minimize', 'Button', 'MinimizeButton', 'Button0', 'Button1']
| | child_window(title="Minimize", control_type="Button")
| |
| | Button - 'Maximize' (L1380, T127, R1426, B157)
| | ['Button2', 'Maximize', 'MaximizeButton']
| | child_window(title="Maximize", control_type="Button")
| |
| | Button - 'Close' (L1426, T127, R1473, B157)
| | ['CloseButton', 'Button3', 'Close']
| | child_window(title="Close", control_type="Button")
Can anyone help?
Thank you very much.
Looks like the + button where you need to click to get the window (shown in second figure) is ownerdrawn.
So, there is only one way to bring up the "Add folder to search" window: use click_input method by passing coordinates.
Once the window comes up, you can use the below code to set the value:
app.DuplicatePhotoCleaner.child_window(title="Folder:", auto_id="1152", control_type="Edit").set_text('Hello world') #or
app.DuplicatePhotoCleaner['Folder:Edit'].set_text('Hello world')
Application().connect(title='Add folder to search')...
Please go though pywinauto docs for further info.
Here is my data.
['date', 'x1', 'x2', 'x3', 'x4', 'x5']
['2014-02-26', '302964.13', '11715.30', '1389.87', '404.63', '304354.00']
['2014-02-25', '297672.69', '7406.57', '1733.45', '345.70', '299406.14']
['2014-02-24', '297957.19', '9933.49', '1514.91', '345.56', '299472.10']
['2014-02-21', '312826.51', '9365.13', '1308.66', '266.03', '314135.17']
['2014-02-20', '325884.05', '10152.87', '1576.65', '483.17', '327460.70']
['2014-02-19', '330013.56', '17205.76', '1729.29', '709.73', '331742.85']
['2014-02-18', '327645.32', '11282.95', '1359.65', '190.63', '329004.96']
['2014-02-17', '324224.52', '13298.12', '1080.77', '145.35', '325305.29']
['2014-02-14', '324022.62', '11353.54', '1254.47', '183.25', '325277.08']
['2014-02-13', '330918.46', '25570.06', '1597.78', '695.83', '332516.24']
['2014-02-12', '324835.65', '10588.67', '1630.50', '456.97', '326466.15']
['2014-02-11', '325785.09', '23822.77', '2214.77', '599.14', '327999.86']
['2014-02-10', '319886.55', '12657.06', '1759.45', '169.27', '321646.00']
['2014-02-07', '312989.44', '11284.82', '2225.87', '165.09', '315215.31']
['2014-01-30', '305685.92', '3278.42', '1441.53', '65.08', '307127.45']
['2014-01-29', '310027.36', '4866.76', '1211.53', '171.60', '311238.89']
['2014-01-28', '311252.25', '5307.47', '1627.93', '110.17', '312880.19']
['2014-01-27', '313464.93', '5316.03', '1579.17', '170.52', '315044.10']
['2014-01-24', '315828.12', '9967.38', '1614.39', '222.52', '317442.51']
I want to wrap it into the form.
I can create the head and body
Head:
| date | x1 | x2 | x3 | x4 | x5 |
body:
|2014-02-27| 303664.88| 9753.48| 1455.21| 483.72| 305120.10|
|2014-02-26| 302964.13| 11715.30| 1389.87| 404.63| 304354.00|
|2014-02-25| 297672.69| 7406.57| 1733.45| 345.70| 299406.14|
|2014-02-24| 297957.19| 9933.49| 1514.91| 345.56| 299472.10|
|2014-02-21| 312826.51| 9365.13| 1308.66| 266.03| 314135.17|
|2014-02-20| 325884.05| 10152.87| 1576.65| 483.17| 327460.70|
|2014-02-19| 330013.56| 17205.76| 1729.29| 709.73| 331742.85|
|2014-02-18| 327645.32| 11282.95| 1359.65| 190.63| 329004.96|
|2014-02-17| 324224.52| 13298.12| 1080.77| 145.35| 325305.29|
|2014-02-14| 324022.62| 11353.54| 1254.47| 183.25| 325277.08|
|2014-02-13| 330918.46| 25570.06| 1597.78| 695.83| 332516.24|
|2014-02-12| 324835.65| 10588.67| 1630.50| 456.97| 326466.15|
|2014-02-11| 325785.09| 23822.77| 2214.77| 599.14| 327999.86|
|2014-02-10| 319886.55| 12657.06| 1759.45| 169.27| 321646.00|
|2014-02-07| 312989.44| 11284.82| 2225.87| 165.09| 315215.31|
|2014-01-30| 305685.92| 3278.42| 1441.53| 65.08| 307127.45|
|2014-01-29| 310027.36| 4866.76| 1211.53| 171.60| 311238.89|
|2014-01-28| 311252.25| 5307.47| 1627.93| 110.17| 312880.19|
|2014-01-27| 313464.93| 5316.03| 1579.17| 170.52| 315044.10|
|2014-01-24| 315828.12| 9967.38| 1614.39| 222.52| 317442.51|
how to create the first line in the table?
┌─────┬─────┬─────┬────┬─────┬──────┐
and the third line in the table?
├─────┼─────┼─────┼────┼─────┼──────┤
and the last line in the table?
└─────┴─────┴─────┴────┴─────┴──────┘
please write it in python.
the form is :
+------------+---------+-------------+
| column_one | col_two | column_3 |
+------------+---------+-------------+
| 0 | 0.0001 | ABCD |
| 1 | 1e-005 | ABCD |
| 2 | 1e-006 | long string |
| 3 | 1e-007 | ABCD |
+------------+---------+-------------+
not absolutely the same as mine posted here.
How obout taking the prettytable output (suggested in comment to your post) and just replacing the + chars with ones from your example? Pretty simple thing.
I'm new to GTK, I'm trying to figure out how to accomplish something like this:
+---+------+---+
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
+---+------+---+
I want this done in an HBox. How would I accomplish this? Thanks.
It is done with "packing".
I always keep the class reference under my pillow : http://www.pygtk.org/docs/pygtk/gtk-class-reference.html
Samples in the good tutorial found here :
http://www.pygtk.org/pygtk2tutorial/sec-DetailsOfBoxes.html
And finally, this shows up something like your drawing :
import gtk as g
win = g.Window ()
win.set_default_size(600, 400)
win.set_position(g.WIN_POS_CENTER)
win.connect ('delete_event', g.main_quit)
hBox = g.HBox()
win.add (hBox)
f1 = g.Frame()
f2 = g.Frame()
f3 = g.Frame()
hBox.pack_start(f1)
hBox.pack_start(f2)
hBox.pack_start(f3)
win.show_all ()
g.main ()
Have fun ! (and I hope my answer is helpful)
The answer is pack_start() and pack_end()
The function has a few parameters you can send to it that give you the desired effect
If you use Louis' example:
hBox.pack_start(f1, expand =False, fill=False)
hBox.pack_start( f2, expand=True, fill=True, padding=50)
hBox.pack_end(f3, expand=False, fill=False)
Hope that helps!